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

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

      Returns string

      The active locale code.

      const locale = useLocale(); // re-renders on setLocale(...)
      
      export function useLocale(): string {
      return useSyncExternalStore(subscribeLocale, getLocale, getLocale);
      }