Trails Packages
    Preparing search index...

    Interface LocaleService

    A service to inspect and control the application's active locale.

    If supportsLiveChanges is false, changeLocale triggers a full application restart. Otherwise the locale is updated in place.

    NOTE: live changes will become the new default with the next major release. Full application restarts due to locale changes will no longer happen then.

    interface LocaleService {
        locale: Locale;
        messageLocale: Locale;
        supportedMessageLocales: readonly Locale[];
        supportsLiveChanges: boolean;
        changeLocale(locale: Locale | undefined): Promise<void>;
        supportsLocale(locale: Locale): boolean;
    }

    Hierarchy (View Summary)

    Index
    locale: Locale

    Reactive: locale used for Intl formatting. Shares language with messageLocale; may add script/region when compatible.

    messageLocale: Locale

    Reactive: the active locale used for i18n messages. If supportedMessageLocales is empty, this falls back to en.

    supportedMessageLocales: readonly Locale[]

    Locales for which the application has translated messages. This list may be empty, if the application has no message bundles.

    supportsLiveChanges: boolean

    Flag indicating whether the application supports live changes for the current locale.

    If true, changeLocale applies the new locale in place. If false, changeLocale triggers a full application restart.

    • Switches to locale. Best-fit match against supportedMessageLocales; throws UNSUPPORTED_LOCALE on no match. undefined enables automatic picking.

      Parameters

      • locale: Locale | undefined

      Returns Promise<void>

    • True iff locale best-fits a supported message locale (regional variants accepted).

      Parameters

      • locale: Locale

      Returns boolean