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

    Function 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.

      Parameters

      • locale: string

        The target locale code (e.g. "pl").

      Returns void

      Nothing.

      setLocale("pl"); // UI re-renders in Polish
      
      export function setLocale(locale: string): void {
      const next = messageTables[locale] ? locale : DEFAULT_LOCALE;
      if (next === currentLocale) return;
      currentLocale = next;
      for (const listener of listeners) listener();
      }