Interface LanguageServiceInterface

interface LanguageServiceInterface {
    onLanguageChange: Signal<LanguageChangeHandler>;
    getCurrentDataLanguage(): Language;
    getCurrentUiLanguage(): Language;
    setDataLanguage(language: DataLanguage): void;
    setLanguage(key: string): Promise<void>;
    setUiLanguage(language: UiLanguage): Promise<void>;
}

Properties

onLanguageChange: Signal<LanguageChangeHandler>

Signal that is emitted when the user interface language has been switched.

Methods

  • Returns the current data language.

    Returns Language

    The language currently being used as the data language.

  • Returns the current user interface language.

    Returns Language

    The language currently being used as the user interface language.

  • Change the data language to the language provided.

    Parameters

    • language: DataLanguage

      An enum with the language to switch to.

    Returns void

  • Switch the current language.

    Note: This changes both the user interface language (used for the default interface) and the data language (used for user-provided names and descriptions). In case the language defined by the language key is not supported, the data language is updated, but not the user interface language.

    If you only want to change the user interface language use the setUiLanguage method. Or, if you only want to change the data language use the setDataLanguage method.

    Parameters

    • key: string

      the two digit ISO-639-1 language key of the language you want to switch to.

    Returns Promise<void>

    Promise which is resolved in case the switch was successful, rejected in case the language isn't supported by the user interface.

  • Change the user interface language to the language provided.

    Parameters

    • language: UiLanguage

      An enum with the language to switch to.

    Returns Promise<void>

    Promise which is resolved in case the switch was successful, rejected in case the language wasn't supported by the user interface.