Hierarchy

  • I18n

Constructors

Properties

fetcher?: LocaleFetcher

Fetch locale of the specified lang.

lang$: ReadonlyVal<string>

A Val of current lang.

locale$: ReadonlyVal<Locale>

A Val of current locale.

locales$: Val<Locales>

A Val of all loaded locales.

t$: ReadonlyVal<TFunction>

A Val of current translate function.

Accessors

  • get lang(): string
  • Current lang.

    Returns string

Methods

  • Add a locale to the locales.

    Use i18n.locales$.set() for more control.

    Parameters

    Returns void

  • Returns

    — boolean indicating whether a message with the specified key in current language exists or not.

    Parameters

    • key: string

    Returns boolean

  • Change language.

    Returns

    — a promise that resolves when the new locale is fetched.

    Parameters

    • lang: string

    Returns Promise<void>

  • Fetch locale of initialLang and return an I18n instance with the locale.

    Parameters

    Returns Promise<I18n>