CupThread React Native & Expo SDK - v0.1.0
    Preparing search index...

    Function getDeviceLocale

    • Reads the device locale for 'auto' locale resolution.

      Returns string | null

      A raw BCP 47 tag from the first available source, or null when nothing is detectable (e.g. plain Node tooling) — callers fall back to 'en'.

      Sources are consulted in order:

      1. The detector registered via setDeviceLocaleProvider (host- or test-provided; always consulted fresh so dynamic sources keep working).
      2. expo-localization — ubiquitous in Expo apps and reflects per-app language overrides.
      3. react-native-localize — the common choice in bare React Native apps.
      4. React Native core: SettingsManager on iOS, I18nManager on Android, navigator.language on web.

      Both localization packages are optional: the requires below use the same runtime-require pattern as getRuntimePlatform() so plain-Node tooling keeps working, and Metro's default allowOptionalDependencies treats the try/catch-wrapped requires as optional instead of failing the bundle when the package is absent. The built-in result is memoized — the device locale is stable within a session — and can be cleared with resetDeviceLocaleCache.