I18n
Type Parameters
C
Constructors
ts
I18n(config: Partial<I18nConfig<C>>);Properties
fluent
ts
readonly fluent: Fluent;locales
ts
readonly locales: Array<string>;Methods
loadLocalesDir
ts
loadLocalesDir(directory: string): Promise<void>;
Loads locales from the specified directory and registers them in the Fluent instance.
loadLocalesDirSync
ts
loadLocalesDirSync(directory: string): void;
Loads locales from any existing nested file or folder within the specified directory and registers them in the Fluent instance.
loadLocale
ts
loadLocale(locale: LocaleId, options: LoadLocaleOptions): Promise<void>;
Registers a locale in the Fluent instance based on the provided options.
loadLocaleSync
ts
loadLocaleSync(locale: LocaleId, options: LoadLocaleOptions): void;
Synchronously registers a locale in the Fluent instance based on the provided options.
t
ts
t<K extends string>(
locale: LocaleId,
key: string,
variables?: TranslationVariables<K>,
): string;
Gets a message by its key from the specified locale. Alias of translate.
translate
ts
translate<K extends string>(
locale: LocaleId,
key: string,
variables?: TranslationVariables<K>,
): string;
Gets a message by its key from the specified locale.
middleware
ts
middleware(): MiddlewareFn<C & I18nFlavor>;
Returns a middleware to .use on the Bot instance.