Interface I18nOptions

Hierarchy

  • I18nOptions

Properties

availableLocales: string[]

Set available locales. This will be used to load pluralizers automatically.

defaultLocale: string

Set default locale. This locale will be used when fallback is enabled and the translation doesn't exist in a particular locale. Defaults to en.

defaultSeparator: string

Set the default string separator. Defaults to ., as in scope.translation.

enableFallback: boolean

Set if engine should fallback to the default locale when a translation is missing. Defaults to false.

When enabled, missing translations will first be looked for in less specific versions of the requested locale and if that fails by taking them from your I18n#defaultLocale.

locale: string

Set the current locale. Defaults to en.

missingBehavior: MissingBehavior

Set missing translation behavior.

  • message will display a message that the translation is missing.
  • guess will try to guess the string.
  • error will raise an exception whenever a translation is not defined.

See register for instructions on how to define your own behavior.

missingPlaceholder: MissingPlaceholderHandler

Return a missing placeholder message for given parameters.

missingTranslationPrefix: string

If you use missingBehavior with 'message', but want to know that the string is actually missing for testing purposes, you can prefix the guessed string by setting the value here. By default, no prefix is used.

nullPlaceholder: NullPlaceholderHandler

Return a placeholder message for null values. Defaults to the same behavior as I18n.missingPlaceholder.

placeholder: RegExp

Set the placeholder format. Accepts {{placeholder}} and %{placeholder}.

transformKey: ((key: string) => string)

Type declaration

    • (key: string): string
    • Transform keys. By default, it returns the key as it is, but allows for overriding. For instance, you can set a function to receive the camelcase key, and convert it to snake case.

      Parameters

      • key: string

      Returns string

Generated using TypeDoc