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