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 * 66 * @example `['en', 'en-US', 'zh-Hans', 'zh-Hans-CN', 'en-emodeng']` 67 */ 68export const locales = ExpoLocalization.locales; 69 70// @needsAudit 71/** 72 * The current time zone in display format. 73 * On Web time zone is calculated with Intl.DateTimeFormat().resolvedOptions().timeZone. For a 74 * better estimation you could use the moment-timezone package but it will add significant bloat to 75 * your website's bundle size. 76 * 77 * @example `'America/Los_Angeles'` 78 */ 79export const timezone = ExpoLocalization.timezone; 80 81// @needsAudit 82/** 83 * The region code for your device that comes from the Region setting under Language & Region on iOS. 84 * This value is always available on iOS, but might return `null` on Android or web. 85 * 86 * @example `'US'`, `'NZ'`, `null` 87 */ 88export const region = ExpoLocalization.region; 89 90// @needsAudit 91/** 92 * Get the latest native values from the device. Locale can be changed on some Android devices 93 * without resetting the app. 94 * > On iOS, changing the locale will cause the device to reset meaning the constants will always be 95 * correct. 96 * 97 * @example 98 * ```ts 99 * // When the app returns from the background on Android... 100 * 101 * const { locale } = await Localization.getLocalizationAsync(); 102 * ``` 103 */ 104export async function getLocalizationAsync(): Promise<Localization> { 105 return await ExpoLocalization.getLocalizationAsync(); 106} 107