Skip to main content
Module

x/grammy_i18n/mod.ts>I18nConfig

Internationalization for grammY powered by Fluent.
Latest
interface I18nConfig
import { type I18nConfig } from "https://deno.land/x/grammy_i18n@v1.0.2/mod.ts";

Type Parameters

optional
C extends Context = Context

Properties

defaultLocale: LocaleId

A locale ID to use by default. This is used when locale negotiator and session (if enabled) returns an empty result. The default value is "en".

optional
directory: string

Directory to load translations from.

optional
useSession: boolean

Whether to use session to get and set language code. You must be using session with it.

optional
fluentOptions: FluentOptions

Configuration for the Fluent instance used internally.

optional
fluentBundleOptions: FluentBundleOptions

Bundle options to use when adding a translation to the Fluent instance.

optional
localeNegotiator: LocaleNegotiator<C>

An optional function that determines which locale to use. See Locale Negotiation for more details.

optional
globalTranslationContext: (ctx: C) => Record<string, FluentVariable>

Convenience function for defining global variables that are used frequently in the translation context. Variables defined inside this can be used directly in the translation source file without having to specifying them when calling the translate function. It is possible to overwrite the values by re-defining them in the translation context of translate function.