The i18n information of a bundle.

interface I18N<KeyType = I18NData> {
    get<ExpectedType = KeyType>(locale?: string): ExpectedType;
    load(locale?: string): Promise<I18N<KeyType>>;
    loc<ExpectedType = I18NValue>(key: string, locale?: string): ExpectedType;
}

Type Parameters

Methods

Methods

  • Get all i18n entries of the bundle.

    Type Parameters

    Parameters

    • Optionallocale: string

      e.g. de or en (optional)

    Returns ExpectedType

    the i18n data

  • Loads the i18n data. This method is used during the 'resolve' phase of a bundle.

    Parameters

    • Optionallocale: string

      e.g. de, en. (optional)

    Returns Promise<I18N<KeyType>>

    a promise resolving to the i18n data.

  • Look up an i18n value for a given key. Note, that this method supports chained keys, e.g. "a.b" This will return 1 from the i18n data structure { 'a': { 'b': '1' }}

    Type Parameters

    Parameters

    • key: string

      the i18n key.

    • Optionallocale: string

      e.g. de or en (optional)

    Returns ExpectedType

    the i18n value