ChemPal Documentation - v1.6.0
    Preparing search index...

    Module helpers/i18n

    Functions - Helpers

    i18n

    Translates a message key into the currently-active locale. Drop-in replacement for chrome.i18n.getMessage(key, subs), but reads the app's own locale so the UI can switch language live (see setLocale).

    getAvailableLocales

    The locale codes that ship a messages.json, sorted alphabetically.

    getLocale

    The currently-active locale code that i18n resolves against.

    setLocale

    Switches the active UI locale and notifies subscribers so the React tree re-renders with the new language. A locale without a bundled messages.json falls back to the default; a no-op when the locale is unchanged.

    useLocale

    React hook that re-renders the calling component whenever the active locale changes. Subscribe near the app root so a language switch cascades to the whole tree; bare i18n() calls in descendants then resolve to the new locale.