1import ExpoLocalization from './ExpoLocalization'; 2import { Localization } from './Localization.types'; 3 4export { Localization }; 5 6// @needsAudit 7/** 8 * Three-character ISO 4217 currency code. Returns `null` on web. 9 * 10 * @example `'USD'`, `'EUR'`, `'CNY'`, `null` 11 */ 12export const currency = ExpoLocalization.currency; 13 14// @needsAudit 15/** 16 * Decimal separator used for formatting numbers. 17 * 18 * @example `','`, `'.'` 19 */ 20export const decimalSeparator = ExpoLocalization.decimalSeparator; 21 22// @needsAudit 23/** 24 * Digit grouping separator used when formatting numbers larger than 1000. 25 * 26 * @example `'.'`, `''`, `','` 27 */ 28export const digitGroupingSeparator = ExpoLocalization.digitGroupingSeparator; 29 30// @needsAudit 31/** 32 * A list of all the supported language ISO codes. 33 */ 34export const isoCurrencyCodes = ExpoLocalization.isoCurrencyCodes; 35 36// @needsAudit 37/** 38 * Boolean value that indicates whether the system uses the metric system. 39 * On Android and web, this is inferred from the current region. 40 */ 41export const isMetric = ExpoLocalization.isMetric; 42 43// @needsAudit 44/** 45 * Returns if the system's language is written from Right-to-Left. 46 * This can be used to build features like [bidirectional icons](https://material.io/design/usability/bidirectionality.html). 47 * 48 * Returns `false` in Server Side Rendering (SSR) environments. 49 */ 50export const isRTL = ExpoLocalization.isRTL; 51 52// @needsAudit 53/** 54 * An [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag), 55 * consisting of a two-character language code and optional script, region and variant codes. 56 * 57 * @example `'en'`, `'en-US'`, `'zh-Hans'`, `'zh-Hans-CN'`, `'en-emodeng'` 58 */ 59export const locale = ExpoLocalization.locale; 60 61// @needsAudit 62/** 63 * List of all the native languages provided by the user settings. 64 * These are returned in the order the user defines in their device settings. 65 */ 66export const locales = ExpoLocalization.locales; 67 68// @needsAudit 69/** 70 * The current time zone in display format. 71 * On Web time zone is calculated with Intl.DateTimeFormat().resolvedOptions().timeZone. For a 72 * better estimation you could use the moment-timezone package but it will add significant bloat to 73 * your website's bundle size. 74 * 75 * @example `'America/Los_Angeles'` 76 */ 77export const timezone = ExpoLocalization.timezone; 78 79// @needsAudit 80/** 81 * The region code for your device that comes from the Region setting under Language & Region on iOS. 82 * This value is always available on iOS, but might return `null` on Android or web. 83 * 84 * @example `'US'`, `'NZ'`, `null` 85 */ 86export const region = ExpoLocalization.region; 87 88// @needsAudit 89/** 90 * Get the latest native values from the device. Locale can be changed on some Android devices 91 * without resetting the app. 92 * > On iOS, changing the locale will cause the device to reset meaning the constants will always be 93 * correct. 94 * 95 * # Example 96 * ```ts 97 * // When the app returns from the background on Android... 98 * 99 * const { locale } = await Localization.getLocalizationAsync(); 100 * ``` 101 */ 102export async function getLocalizationAsync(): Promise<Localization> { 103 return await ExpoLocalization.getLocalizationAsync(); 104} 105