Offers functions to retrieve the text associated with language constants corresponding to the currently selected language within the portal settings.

Important

For ease of use, the methods can be invoked directly through ix.text.i18n.methodName();, eliminating the need to create a class instance.

Usage

ix.api.text.i18n

Example

// Retrieves the currently selected language
ix.api.text.i18n.lang;

// Retrieve a language constant
ix.api.text.i18n.get("<LANGUAGE-CONSTANT>");

Hierarchy

  • I18nWrapper

Accessors

Methods

Accessors

  • get defaultLang(): string
  • The default language within the portal settings.

    Returns string

    Example

    ix.api.text.i18n.defaultLang; // e.g. "en"
    
  • get lang(): string
  • The currently selected language within the portal settings.

    Returns string

    Example

    ix.api.text.i18n.lang; // e.g. "en"
    

Methods

  • Retrieve a portal constant by its key with an optional fallback.

    Parameters

    • languageConstant: string

      The key of the constant.

    • Optional fallback: string

      The fallback to be used, if key wasn't found.

    Returns undefined | string

    Example

    ix.api.text.i18n.get("<LANGUAGE-CONSTANT>", "Fallback text");

    // Get the value of the language constant "GEN_SAVE"
    ix.api.text.i18n.get("GEN_SAVE");

    // Returns:
    // - "Save" if the current language is English
    // - "Speichern" if the current language is German
    // - "Sauvegarder" if the current language is French
  • Retrieve an application constant by its key with an optional fallback.

    Parameters

    • appGuid: string

      The application GUID.

    • languageConstant: string

      The key of the constant.

    • Optional fallback: string

      The fallback to be used, if key wasn't found.

    Returns undefined | string

    Example

    ix.api.text.i18n.getByApp("<APP-GUID>", "<LANGUAGE-CONSTANT>", "Fallback text");