From 83d99d609d2afad13a89677c3336be39222d2d6a Mon Sep 17 00:00:00 2001 From: fhelwanger Date: Mon, 4 Mar 2019 17:49:48 -0300 Subject: [PATCH] [expo] Add Localization --- types/expo/expo-tests.tsx | 23 +++++++++++++++++++++++ types/expo/index.d.ts | 23 +++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/types/expo/expo-tests.tsx b/types/expo/expo-tests.tsx index f2ce8d8197..132290f576 100644 --- a/types/expo/expo-tests.tsx +++ b/types/expo/expo-tests.tsx @@ -37,6 +37,7 @@ import { LinearGradient, Linking, Location, + Localization, MailComposer, MapEvent, MapStyleElement, @@ -1094,6 +1095,28 @@ async () => { }; // #endregion +// #region Localization + +let locale: string = Localization.locale; +let locales: string[] = Localization.locales; +let country: string | undefined = Localization.country; +let isoCurrencyCodes: string[] | undefined = Localization.isoCurrencyCodes; +let timezone: string = Localization.timezone; +let isRTL: boolean = Localization.isRTL; + +async () => { + const localizationData = await Localization.getLocalizationAsync(); + + locale = localizationData.locale; + locales = localizationData.locales; + country = localizationData.country; + isoCurrencyCodes = localizationData.isoCurrencyCodes; + timezone = localizationData.timezone; + isRTL = localizationData.isRTL; +}; + +// #endregion + // #region Contacts Contacts.Fields.ID === 'id'; Contacts.Fields.Name === 'name'; diff --git a/types/expo/index.d.ts b/types/expo/index.d.ts index 7e75c1b7d6..777d574eea 100644 --- a/types/expo/index.d.ts +++ b/types/expo/index.d.ts @@ -2244,6 +2244,29 @@ export namespace Location { function setApiKey(key: string): void; } +/** + * Localization + */ +export namespace Localization { + const locale: string; + const locales: string[]; + const country: string | undefined; + const isoCurrencyCodes: string[] | undefined; + const timezone: string; + const isRTL: boolean; + + interface LocalizationData { + locale: string; + locales: string[]; + country?: string; + isoCurrencyCodes?: string[]; + timezone: string; + isRTL: boolean; + } + + function getLocalizationAsync(): Promise; +} + /** * Magnetometer */