UNPKG

6.5 kBTypeScriptView Raw
1import { Localization } from './Localization.types';
2export * from './Localization.types';
3/**
4 * @hidden
5 * @deprecated Use Localization.getLocales() instead.
6 * Three-character ISO 4217 currency code. Returns `null` on web.
7 *
8 * @example
9 * `'USD'`, `'EUR'`, `'CNY'`, `null`
10 */
11export declare const currency: string | null;
12/**
13 * @hidden
14 * @deprecated Use Localization.getLocales() instead.
15 * Decimal separator used for formatting numbers.
16 *
17 * @example
18 * `','`, `'.'`
19 */
20export declare const decimalSeparator: string;
21/**
22 * @hidden
23 * @deprecated Use Localization.getLocales() instead.
24 * Digit grouping separator used when formatting numbers larger than 1000.
25 *
26 * @example
27 * `'.'`, `''`, `','`
28 */
29export declare const digitGroupingSeparator: string;
30/**
31 * @hidden
32 * @deprecated Use Localization.getLocales() instead.
33 * A list of all the supported language ISO codes.
34 */
35export declare const isoCurrencyCodes: string[];
36/**
37 * @hidden
38 * @deprecated Use Localization.getLocales() instead.
39 * Boolean value that indicates whether the system uses the metric system.
40 * On Android and web, this is inferred from the current region.
41 */
42export declare const isMetric: boolean;
43/**
44 * @hidden
45 * @deprecated Use Localization.getLocales() instead.
46 * Returns if the system's language is written from Right-to-Left.
47 * This can be used to build features like [bidirectional icons](https://material.io/design/usability/bidirectionality.html).
48 *
49 * Returns `false` in Server Side Rendering (SSR) environments.
50 */
51export declare const isRTL: boolean;
52/**
53 * @deprecated Use [`Localization.getLocales()`](#localizationgetlocales) instead.
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
58 * `'en'`, `'en-US'`, `'zh-Hans'`, `'zh-Hans-CN'`, `'en-emodeng'`
59 */
60export declare const locale: string;
61/**
62 * @hidden
63 * @deprecated Use Localization.getLocales() instead.
64 * List of all the native languages provided by the user settings.
65 * These are returned in the order the user defines in their device settings.
66 *
67 * @example
68 * `['en', 'en-US', 'zh-Hans', 'zh-Hans-CN', 'en-emodeng']`
69 */
70export declare const locales: string[];
71/**
72 * @hidden
73 * @deprecated Use Localization.getCalendars() instead.
74 * The current time zone in display format.
75 * On Web time zone is calculated with Intl.DateTimeFormat().resolvedOptions().timeZone. For a
76 * better estimation you could use the moment-timezone package but it will add significant bloat to
77 * your website's bundle size.
78 *
79 * @example
80 * `'America/Los_Angeles'`
81 */
82export declare const timezone: string;
83/**
84 * @hidden
85 * @deprecated Use Localization.getLocales() instead.
86 * The region code for your device that comes from the Region setting under Language & Region on iOS.
87 * This value is always available on iOS, but might return `null` on Android or web.
88 *
89 * @example
90 * `'US'`, `'NZ'`, `null`
91 */
92export declare const region: string | null;
93/**
94 * List of user's locales, returned as an array of objects of type `Locale`.
95 * Guaranteed to contain at least 1 element.
96 * These are returned in the order the user defines in their device settings.
97 * On the web currency and measurements systems are not provided, instead returned as null.
98 * If needed, you can infer them from the current region using a lookup table.
99 * @example
100 * ```js
101 * [{
102 * "languageTag": "pl-PL",
103 * "languageCode": "pl",
104 * "textDirection": "ltr",
105 * "digitGroupingSeparator": " ",
106 * "decimalSeparator": ",",
107 * "measurementSystem": "metric",
108 * "currencyCode": "PLN",
109 * "currencySymbol": "zł",
110 * "regionCode": "PL",
111 * "temperatureUnit": "celsius"
112 * }]
113 * ```
114 */
115export declare const getLocales: () => import("./Localization.types").Locale[];
116/**
117 * List of user's preferred calendars, returned as an array of objects of type `Calendar`.
118 * Guaranteed to contain at least 1 element.
119 * For now always returns a single element, but it's likely to return a user preference list on some platforms in the future.
120 * @example
121 * ```js
122 * [{
123 * "calendar": "gregory",
124 * "timeZone": "Europe/Warsaw",
125 * "uses24hourClock": true,
126 * "firstWeekday": 1
127 * }]
128 * ```
129 */
130export declare const getCalendars: () => import("./Localization.types").Calendar[];
131/**
132 * A hook providing a list of user's locales, returned as an array of objects of type `Locale`.
133 * Guaranteed to contain at least 1 element.
134 * These are returned in the order the user defines in their device settings.
135 * On the web currency and measurements systems are not provided, instead returned as null.
136 * If needed, you can infer them from the current region using a lookup table.
137 * If the OS settings change, the hook will rerender with a new list of locales.
138 * @example
139 * ```js
140 * [{
141 * "languageTag": "pl-PL",
142 * "languageCode": "pl",
143 * "textDirection": "ltr",
144 * "digitGroupingSeparator": " ",
145 * "decimalSeparator": ",",
146 * "measurementSystem": "metric",
147 * "currencyCode": "PLN",
148 * "currencySymbol": "zł",
149 * "regionCode": "PL",
150 * "temperatureUnit": "celsius"
151 * }]
152 * ```
153 */
154export declare function useLocales(): import("./Localization.types").Locale[];
155/**
156 * A hook providing a list of user's preferred calendars, returned as an array of objects of type `Calendar`.
157 * Guaranteed to contain at least 1 element.
158 * For now always returns a single element, but it's likely to return a user preference list on some platforms in the future.
159 * If the OS settings change, the hook will rerender with a new list of calendars.
160 * @example
161 * ```js
162 * [{
163 * "calendar": "gregory",
164 * "timeZone": "Europe/Warsaw",
165 * "uses24hourClock": true,
166 * "firstWeekday": 1
167 * }]
168 * ```
169 */
170export declare function useCalendars(): import("./Localization.types").Calendar[];
171/**
172 * @hidden
173 * Get the latest native values from the device. Locale can be changed on some Android devices
174 * without resetting the app.
175 * > On iOS, changing the locale will cause the device to reset meaning the constants will always be
176 * correct.
177 *
178 * @example
179 * ```ts
180 * // When the app returns from the background on Android...
181 *
182 * const { locale } = await Localization.getLocalizationAsync();
183 * ```
184 * @deprecated
185 * Use Localization.getLocales() or Localization.getCalendars() instead.
186 */
187export declare function getLocalizationAsync(): Promise<Localization>;
188//# sourceMappingURL=Localization.d.ts.map
\No newline at end of file