Preparing search index...

    Function useI18n

    • Hook providing translation utilities for React components.

      Wraps react-i18next's useTranslation and exposes a stable API for reading and changing the active locale.

      Returns {
          t: TFunction<"translation", undefined>;
          setLocale: (locale: string) => Promise<any>;
          getLocale: () => string;
          getAvailableLocales: () => ("en" | "fr")[];
          getLocaleName: (locale: string) => string;
      }

      An object containing:

      • t — the i18next translation function
      • setLocale(locale) — changes the active language; resolves when loaded
      • getLocale() — returns the current language code (e.g. 'en')
      • getAvailableLocales() — returns all supported SupportedLanguage codes
      • getLocaleName(locale) — returns the display name for a language code, or the raw code if it is not in SUPPORTED_LANGUAGES
      const { t, setLocale, getLocale } = useI18n();
      return <Button onPress={() => setLocale('fr')}>{t('settings.language')}</Button>;