UNPKG

@meshconnect/react-native-link-sdk

Version:
24 lines (23 loc) 1.21 kB
/** * Resolves the device's current language as a BCP-47 tag (e.g. `en-US`). * This is the React Native equivalent of the web SDK's `navigator.language`, * used to expand `settings.language: 'system'` into a concrete tag before it * is sent to the hosted Link UI (the UI expects a real tag, not `'system'`). * * The native settings modules are read first because they reflect the real * device language on every JS engine. `Intl` is only a fallback: on Hermes * builds without full ICU (and on JSC) it can report a fixed `en-US` rather * than the device locale, so trusting it first would silently force English * for non-English users. * * Returns `undefined` when no locale can be determined so callers can apply * their own fallback. */ export declare function getSystemLanguage(): string | undefined; /** * Resolves a `settings.language` value into the concrete tag to send as `lng`. * `'system'` expands to the device locale (falling back to `'en'` when it * cannot be determined); any other value is passed through unchanged, and * `undefined` stays `undefined` so no `lng` param is added. */ export declare function resolveLanguage(language: string | undefined): string | undefined;