expo-localization 14.5.0 → 14.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/android/build.gradle +48 -29
- package/build/Localization.d.ts +11 -1
- package/build/Localization.d.ts.map +1 -1
- package/build/Localization.js +11 -1
- package/build/Localization.js.map +1 -1
- package/build/Localization.types.d.ts +1 -1
- package/build/Localization.types.d.ts.map +1 -1
- package/build/Localization.types.js.map +1 -1
- package/ios/ExpoLocalization.podspec +1 -1
- package/ios/LocalizationModule.swift +15 -1
- package/package.json +2 -2
- package/src/Localization.ts +11 -1
- package/src/Localization.types.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,35 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 14.7.0 — 2023-11-14
|
|
14
|
+
|
|
15
|
+
### 🛠 Breaking changes
|
|
16
|
+
|
|
17
|
+
- Bumped iOS deployment target to 13.4. ([#25063](https://github.com/expo/expo/pull/25063) by [@gabrieldonadel](https://github.com/gabrieldonadel))
|
|
18
|
+
- On `Android` bump `compileSdkVersion` and `targetSdkVersion` to `34`. ([#24708](https://github.com/expo/expo/pull/24708) by [@alanjhughes](https://github.com/alanjhughes))
|
|
19
|
+
|
|
20
|
+
### 🐛 Bug fixes
|
|
21
|
+
|
|
22
|
+
- [iOS] Fix expo-localization tvOS compile, add CI. ([#25082](https://github.com/expo/expo/pull/25082) by [@douglowder](https://github.com/douglowder))
|
|
23
|
+
|
|
24
|
+
### 💡 Others
|
|
25
|
+
|
|
26
|
+
- [iOS] Use newer, non-deprecated platform APIs in `getLocales()`. ([#24884](https://github.com/expo/expo/pull/24884) by [@aleqsio](https://github.com/aleqsio))
|
|
27
|
+
|
|
28
|
+
### ⚠️ Notices
|
|
29
|
+
|
|
30
|
+
- Deprecated `locale` constant. ([#25078](https://github.com/expo/expo/pull/25078) by [@aleqsio](https://github.com/aleqsio))
|
|
31
|
+
|
|
32
|
+
## 14.6.0 — 2023-10-17
|
|
33
|
+
|
|
34
|
+
### 🛠 Breaking changes
|
|
35
|
+
|
|
36
|
+
- Dropped support for Android SDK 21 and 22. ([#24201](https://github.com/expo/expo/pull/24201) by [@behenate](https://github.com/behenate))
|
|
37
|
+
|
|
38
|
+
### 🐛 Bug fixes
|
|
39
|
+
|
|
40
|
+
- [iOS] fix tvOS compilation. ([#24845](https://github.com/expo/expo/pull/24845) by [@douglowder](https://github.com/douglowder))
|
|
41
|
+
|
|
13
42
|
## 14.5.0 — 2023-09-04
|
|
14
43
|
|
|
15
44
|
### 🎉 New features
|
package/android/build.gradle
CHANGED
|
@@ -3,15 +3,20 @@ apply plugin: 'kotlin-android'
|
|
|
3
3
|
apply plugin: 'maven-publish'
|
|
4
4
|
|
|
5
5
|
group = 'host.exp.exponent'
|
|
6
|
-
version = '14.
|
|
6
|
+
version = '14.7.0'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
9
|
+
if (expoModulesCorePlugin.exists()) {
|
|
10
|
+
apply from: expoModulesCorePlugin
|
|
11
|
+
applyKotlinExpoModulesCorePlugin()
|
|
12
|
+
// Remove this check, but keep the contents after SDK49 support is dropped
|
|
13
|
+
if (safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
14
|
+
useExpoPublishing()
|
|
15
|
+
useCoreDependencies()
|
|
13
16
|
}
|
|
17
|
+
}
|
|
14
18
|
|
|
19
|
+
buildscript {
|
|
15
20
|
// Simple helper that allows the root project to override versions declared by this library.
|
|
16
21
|
ext.safeExtGet = { prop, fallback ->
|
|
17
22
|
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
@@ -35,23 +40,44 @@ buildscript {
|
|
|
35
40
|
}
|
|
36
41
|
}
|
|
37
42
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
// Remove this if and it's contents, when support for SDK49 is dropped
|
|
44
|
+
if (!safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
45
|
+
afterEvaluate {
|
|
46
|
+
publishing {
|
|
47
|
+
publications {
|
|
48
|
+
release(MavenPublication) {
|
|
49
|
+
from components.release
|
|
50
|
+
}
|
|
43
51
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
52
|
+
repositories {
|
|
53
|
+
maven {
|
|
54
|
+
url = mavenLocal().url
|
|
55
|
+
}
|
|
48
56
|
}
|
|
49
57
|
}
|
|
50
58
|
}
|
|
51
59
|
}
|
|
52
60
|
|
|
53
61
|
android {
|
|
54
|
-
|
|
62
|
+
// Remove this if and it's contents, when support for SDK49 is dropped
|
|
63
|
+
if (!safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
64
|
+
compileSdkVersion safeExtGet("compileSdkVersion", 34)
|
|
65
|
+
|
|
66
|
+
defaultConfig {
|
|
67
|
+
minSdkVersion safeExtGet("minSdkVersion", 23)
|
|
68
|
+
targetSdkVersion safeExtGet("targetSdkVersion", 34)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
publishing {
|
|
72
|
+
singleVariant("release") {
|
|
73
|
+
withSourcesJar()
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
lintOptions {
|
|
78
|
+
abortOnError false
|
|
79
|
+
}
|
|
80
|
+
}
|
|
55
81
|
|
|
56
82
|
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
|
|
57
83
|
if (agpVersion.tokenize('.')[0].toInteger() < 8) {
|
|
@@ -67,24 +93,17 @@ android {
|
|
|
67
93
|
|
|
68
94
|
namespace "expo.modules.localization"
|
|
69
95
|
defaultConfig {
|
|
70
|
-
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
71
|
-
targetSdkVersion safeExtGet("targetSdkVersion", 33)
|
|
72
96
|
versionCode 22
|
|
73
|
-
versionName "14.
|
|
74
|
-
}
|
|
75
|
-
lintOptions {
|
|
76
|
-
abortOnError false
|
|
77
|
-
}
|
|
78
|
-
publishing {
|
|
79
|
-
singleVariant("release") {
|
|
80
|
-
withSourcesJar()
|
|
81
|
-
}
|
|
97
|
+
versionName "14.7.0"
|
|
82
98
|
}
|
|
83
99
|
}
|
|
84
100
|
|
|
85
101
|
dependencies {
|
|
86
|
-
|
|
102
|
+
// Remove this if and it's contents, when support for SDK49 is dropped
|
|
103
|
+
if (!safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
104
|
+
implementation project(':expo-modules-core')
|
|
105
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
|
|
106
|
+
}
|
|
87
107
|
|
|
88
|
-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
|
|
89
108
|
implementation "androidx.core:core-ktx:1.6.0"
|
|
90
109
|
}
|
package/build/Localization.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Localization } from './Localization.types';
|
|
2
2
|
export * from './Localization.types';
|
|
3
3
|
/**
|
|
4
|
+
* @hidden
|
|
4
5
|
* @deprecated Use Localization.getLocales() instead.
|
|
5
6
|
* Three-character ISO 4217 currency code. Returns `null` on web.
|
|
6
7
|
*
|
|
@@ -8,6 +9,7 @@ export * from './Localization.types';
|
|
|
8
9
|
*/
|
|
9
10
|
export declare const currency: string | null;
|
|
10
11
|
/**
|
|
12
|
+
* @hidden
|
|
11
13
|
* @deprecated Use Localization.getLocales() instead.
|
|
12
14
|
* Decimal separator used for formatting numbers.
|
|
13
15
|
*
|
|
@@ -15,6 +17,7 @@ export declare const currency: string | null;
|
|
|
15
17
|
*/
|
|
16
18
|
export declare const decimalSeparator: string;
|
|
17
19
|
/**
|
|
20
|
+
* @hidden
|
|
18
21
|
* @deprecated Use Localization.getLocales() instead.
|
|
19
22
|
* Digit grouping separator used when formatting numbers larger than 1000.
|
|
20
23
|
*
|
|
@@ -22,17 +25,20 @@ export declare const decimalSeparator: string;
|
|
|
22
25
|
*/
|
|
23
26
|
export declare const digitGroupingSeparator: string;
|
|
24
27
|
/**
|
|
28
|
+
* @hidden
|
|
25
29
|
* @deprecated Use Localization.getLocales() instead.
|
|
26
30
|
* A list of all the supported language ISO codes.
|
|
27
31
|
*/
|
|
28
32
|
export declare const isoCurrencyCodes: string[];
|
|
29
33
|
/**
|
|
34
|
+
* @hidden
|
|
30
35
|
* @deprecated Use Localization.getLocales() instead.
|
|
31
36
|
* Boolean value that indicates whether the system uses the metric system.
|
|
32
37
|
* On Android and web, this is inferred from the current region.
|
|
33
38
|
*/
|
|
34
39
|
export declare const isMetric: boolean;
|
|
35
40
|
/**
|
|
41
|
+
* @hidden
|
|
36
42
|
* @deprecated Use Localization.getLocales() instead.
|
|
37
43
|
* Returns if the system's language is written from Right-to-Left.
|
|
38
44
|
* This can be used to build features like [bidirectional icons](https://material.io/design/usability/bidirectionality.html).
|
|
@@ -41,7 +47,7 @@ export declare const isMetric: boolean;
|
|
|
41
47
|
*/
|
|
42
48
|
export declare const isRTL: boolean;
|
|
43
49
|
/**
|
|
44
|
-
*
|
|
50
|
+
* @deprecated Use [`Localization.getLocales()`](#localizationgetlocales) instead.
|
|
45
51
|
* An [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag),
|
|
46
52
|
* consisting of a two-character language code and optional script, region and variant codes.
|
|
47
53
|
*
|
|
@@ -49,6 +55,7 @@ export declare const isRTL: boolean;
|
|
|
49
55
|
*/
|
|
50
56
|
export declare const locale: string;
|
|
51
57
|
/**
|
|
58
|
+
* @hidden
|
|
52
59
|
* @deprecated Use Localization.getLocales() instead.
|
|
53
60
|
* List of all the native languages provided by the user settings.
|
|
54
61
|
* These are returned in the order the user defines in their device settings.
|
|
@@ -57,6 +64,7 @@ export declare const locale: string;
|
|
|
57
64
|
*/
|
|
58
65
|
export declare const locales: string[];
|
|
59
66
|
/**
|
|
67
|
+
* @hidden
|
|
60
68
|
* @deprecated Use Localization.getCalendars() instead.
|
|
61
69
|
* The current time zone in display format.
|
|
62
70
|
* On Web time zone is calculated with Intl.DateTimeFormat().resolvedOptions().timeZone. For a
|
|
@@ -67,6 +75,7 @@ export declare const locales: string[];
|
|
|
67
75
|
*/
|
|
68
76
|
export declare const timezone: string;
|
|
69
77
|
/**
|
|
78
|
+
* @hidden
|
|
70
79
|
* @deprecated Use Localization.getLocales() instead.
|
|
71
80
|
* The region code for your device that comes from the Region setting under Language & Region on iOS.
|
|
72
81
|
* This value is always available on iOS, but might return `null` on Android or web.
|
|
@@ -145,6 +154,7 @@ export declare function useLocales(): import("./Localization.types").Locale[];
|
|
|
145
154
|
*/
|
|
146
155
|
export declare function useCalendars(): import("./Localization.types").Calendar[];
|
|
147
156
|
/**
|
|
157
|
+
* @hidden
|
|
148
158
|
* Get the latest native values from the device. Locale can be changed on some Android devices
|
|
149
159
|
* without resetting the app.
|
|
150
160
|
* > On iOS, changing the locale will cause the device to reset meaning the constants will always be
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Localization.d.ts","sourceRoot":"","sources":["../src/Localization.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,cAAc,sBAAsB,CAAC;AAGrC
|
|
1
|
+
{"version":3,"file":"Localization.d.ts","sourceRoot":"","sources":["../src/Localization.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,cAAc,sBAAsB,CAAC;AAGrC;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,eAA4B,CAAC;AAGlD;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,QAAoC,CAAC;AAGlE;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,QAA0C,CAAC;AAG9E;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,UAAoC,CAAC;AAGlE;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,SAA4B,CAAC;AAGlD;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,SAAyB,CAAC;AAG5C;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,QAA0B,CAAC;AAG9C;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,UAA2B,CAAC;AAGhD;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ,QAA4B,CAAC;AAGlD;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,eAA0B,CAAC;AAE9C;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,UAAU,+CAA8B,CAAC;AAEtD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,YAAY,iDAAgC,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,UAAU,4CAUzB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,8CAU3B;AAGD;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,YAAY,CAAC,CAElE"}
|
package/build/Localization.js
CHANGED
|
@@ -3,6 +3,7 @@ import ExpoLocalization, { addCalendarListener, addLocaleListener, removeSubscri
|
|
|
3
3
|
export * from './Localization.types';
|
|
4
4
|
// @needsAudit
|
|
5
5
|
/**
|
|
6
|
+
* @hidden
|
|
6
7
|
* @deprecated Use Localization.getLocales() instead.
|
|
7
8
|
* Three-character ISO 4217 currency code. Returns `null` on web.
|
|
8
9
|
*
|
|
@@ -11,6 +12,7 @@ export * from './Localization.types';
|
|
|
11
12
|
export const currency = ExpoLocalization.currency;
|
|
12
13
|
// @needsAudit
|
|
13
14
|
/**
|
|
15
|
+
* @hidden
|
|
14
16
|
* @deprecated Use Localization.getLocales() instead.
|
|
15
17
|
* Decimal separator used for formatting numbers.
|
|
16
18
|
*
|
|
@@ -19,6 +21,7 @@ export const currency = ExpoLocalization.currency;
|
|
|
19
21
|
export const decimalSeparator = ExpoLocalization.decimalSeparator;
|
|
20
22
|
// @needsAudit
|
|
21
23
|
/**
|
|
24
|
+
* @hidden
|
|
22
25
|
* @deprecated Use Localization.getLocales() instead.
|
|
23
26
|
* Digit grouping separator used when formatting numbers larger than 1000.
|
|
24
27
|
*
|
|
@@ -27,12 +30,14 @@ export const decimalSeparator = ExpoLocalization.decimalSeparator;
|
|
|
27
30
|
export const digitGroupingSeparator = ExpoLocalization.digitGroupingSeparator;
|
|
28
31
|
// @needsAudit
|
|
29
32
|
/**
|
|
33
|
+
* @hidden
|
|
30
34
|
* @deprecated Use Localization.getLocales() instead.
|
|
31
35
|
* A list of all the supported language ISO codes.
|
|
32
36
|
*/
|
|
33
37
|
export const isoCurrencyCodes = ExpoLocalization.isoCurrencyCodes;
|
|
34
38
|
// @needsAudit
|
|
35
39
|
/**
|
|
40
|
+
* @hidden
|
|
36
41
|
* @deprecated Use Localization.getLocales() instead.
|
|
37
42
|
* Boolean value that indicates whether the system uses the metric system.
|
|
38
43
|
* On Android and web, this is inferred from the current region.
|
|
@@ -40,6 +45,7 @@ export const isoCurrencyCodes = ExpoLocalization.isoCurrencyCodes;
|
|
|
40
45
|
export const isMetric = ExpoLocalization.isMetric;
|
|
41
46
|
// @needsAudit
|
|
42
47
|
/**
|
|
48
|
+
* @hidden
|
|
43
49
|
* @deprecated Use Localization.getLocales() instead.
|
|
44
50
|
* Returns if the system's language is written from Right-to-Left.
|
|
45
51
|
* This can be used to build features like [bidirectional icons](https://material.io/design/usability/bidirectionality.html).
|
|
@@ -49,7 +55,7 @@ export const isMetric = ExpoLocalization.isMetric;
|
|
|
49
55
|
export const isRTL = ExpoLocalization.isRTL;
|
|
50
56
|
// @needsAudit
|
|
51
57
|
/**
|
|
52
|
-
*
|
|
58
|
+
* @deprecated Use [`Localization.getLocales()`](#localizationgetlocales) instead.
|
|
53
59
|
* An [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag),
|
|
54
60
|
* consisting of a two-character language code and optional script, region and variant codes.
|
|
55
61
|
*
|
|
@@ -58,6 +64,7 @@ export const isRTL = ExpoLocalization.isRTL;
|
|
|
58
64
|
export const locale = ExpoLocalization.locale;
|
|
59
65
|
// @needsAudit
|
|
60
66
|
/**
|
|
67
|
+
* @hidden
|
|
61
68
|
* @deprecated Use Localization.getLocales() instead.
|
|
62
69
|
* List of all the native languages provided by the user settings.
|
|
63
70
|
* These are returned in the order the user defines in their device settings.
|
|
@@ -67,6 +74,7 @@ export const locale = ExpoLocalization.locale;
|
|
|
67
74
|
export const locales = ExpoLocalization.locales;
|
|
68
75
|
// @needsAudit
|
|
69
76
|
/**
|
|
77
|
+
* @hidden
|
|
70
78
|
* @deprecated Use Localization.getCalendars() instead.
|
|
71
79
|
* The current time zone in display format.
|
|
72
80
|
* On Web time zone is calculated with Intl.DateTimeFormat().resolvedOptions().timeZone. For a
|
|
@@ -78,6 +86,7 @@ export const locales = ExpoLocalization.locales;
|
|
|
78
86
|
export const timezone = ExpoLocalization.timezone;
|
|
79
87
|
// @needsAudit
|
|
80
88
|
/**
|
|
89
|
+
* @hidden
|
|
81
90
|
* @deprecated Use Localization.getLocales() instead.
|
|
82
91
|
* The region code for your device that comes from the Region setting under Language & Region on iOS.
|
|
83
92
|
* This value is always available on iOS, but might return `null` on Android or web.
|
|
@@ -177,6 +186,7 @@ export function useCalendars() {
|
|
|
177
186
|
}
|
|
178
187
|
// @needsAudit
|
|
179
188
|
/**
|
|
189
|
+
* @hidden
|
|
180
190
|
* Get the latest native values from the device. Locale can be changed on some Android devices
|
|
181
191
|
* without resetting the app.
|
|
182
192
|
* > On iOS, changing the locale will cause the device to reset meaning the constants will always be
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Localization.js","sourceRoot":"","sources":["../src/Localization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEvD,O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AY,CAAC,CAAC;QACnC,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,cAAc;AACd;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB;IACxC,OAAO,MAAM,gBAAgB,CAAC,oBAAoB,EAAE,CAAC;AACvD,CAAC","sourcesContent":["import { useEffect, useReducer, useMemo } from 'react';\n\nimport ExpoLocalization, {\n addCalendarListener,\n addLocaleListener,\n removeSubscription,\n} from './ExpoLocalization';\nimport { Localization } from './Localization.types';\nexport * from './Localization.types';\n\n// @needsAudit\n/**\n * @hidden\n * @deprecated Use Localization.getLocales() instead.\n * Three-character ISO 4217 currency code. Returns `null` on web.\n *\n * @example `'USD'`, `'EUR'`, `'CNY'`, `null`\n */\nexport const currency = ExpoLocalization.currency;\n\n// @needsAudit\n/**\n * @hidden\n * @deprecated Use Localization.getLocales() instead.\n * Decimal separator used for formatting numbers.\n *\n * @example `','`, `'.'`\n */\nexport const decimalSeparator = ExpoLocalization.decimalSeparator;\n\n// @needsAudit\n/**\n * @hidden\n * @deprecated Use Localization.getLocales() instead.\n * Digit grouping separator used when formatting numbers larger than 1000.\n *\n * @example `'.'`, `''`, `','`\n */\nexport const digitGroupingSeparator = ExpoLocalization.digitGroupingSeparator;\n\n// @needsAudit\n/**\n * @hidden\n * @deprecated Use Localization.getLocales() instead.\n * A list of all the supported language ISO codes.\n */\nexport const isoCurrencyCodes = ExpoLocalization.isoCurrencyCodes;\n\n// @needsAudit\n/**\n * @hidden\n * @deprecated Use Localization.getLocales() instead.\n * Boolean value that indicates whether the system uses the metric system.\n * On Android and web, this is inferred from the current region.\n */\nexport const isMetric = ExpoLocalization.isMetric;\n\n// @needsAudit\n/**\n * @hidden\n * @deprecated Use Localization.getLocales() instead.\n * Returns if the system's language is written from Right-to-Left.\n * This can be used to build features like [bidirectional icons](https://material.io/design/usability/bidirectionality.html).\n *\n * Returns `false` in Server Side Rendering (SSR) environments.\n */\nexport const isRTL = ExpoLocalization.isRTL;\n\n// @needsAudit\n/**\n * @deprecated Use [`Localization.getLocales()`](#localizationgetlocales) instead.\n * An [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag),\n * consisting of a two-character language code and optional script, region and variant codes.\n *\n * @example `'en'`, `'en-US'`, `'zh-Hans'`, `'zh-Hans-CN'`, `'en-emodeng'`\n */\nexport const locale = ExpoLocalization.locale;\n\n// @needsAudit\n/**\n * @hidden\n * @deprecated Use Localization.getLocales() instead.\n * List of all the native languages provided by the user settings.\n * These are returned in the order the user defines in their device settings.\n *\n * @example `['en', 'en-US', 'zh-Hans', 'zh-Hans-CN', 'en-emodeng']`\n */\nexport const locales = ExpoLocalization.locales;\n\n// @needsAudit\n/**\n * @hidden\n * @deprecated Use Localization.getCalendars() instead.\n * The current time zone in display format.\n * On Web time zone is calculated with Intl.DateTimeFormat().resolvedOptions().timeZone. For a\n * better estimation you could use the moment-timezone package but it will add significant bloat to\n * your website's bundle size.\n *\n * @example `'America/Los_Angeles'`\n */\nexport const timezone = ExpoLocalization.timezone;\n\n// @needsAudit\n/**\n * @hidden\n * @deprecated Use Localization.getLocales() instead.\n * The region code for your device that comes from the Region setting under Language & Region on iOS.\n * This value is always available on iOS, but might return `null` on Android or web.\n *\n * @example `'US'`, `'NZ'`, `null`\n */\nexport const region = ExpoLocalization.region;\n\n/**\n * List of user's locales, returned as an array of objects of type `Locale`.\n * Guaranteed to contain at least 1 element.\n * These are returned in the order the user defines in their device settings.\n * On the web currency and measurements systems are not provided, instead returned as null.\n * If needed, you can infer them from the current region using a lookup table.\n * @example `[{\n \"languageTag\": \"pl-PL\",\n \"languageCode\": \"pl\",\n \"textDirection\": \"ltr\",\n \"digitGroupingSeparator\": \" \",\n \"decimalSeparator\": \",\",\n \"measurementSystem\": \"metric\",\n \"currencyCode\": \"PLN\",\n \"currencySymbol\": \"zł\",\n \"regionCode\": \"PL\",\n \"temperatureUnit\": \"celsius\"\n }]`\n */\nexport const getLocales = ExpoLocalization.getLocales;\n\n/**\n * List of user's preferred calendars, returned as an array of objects of type `Calendar`.\n * Guaranteed to contain at least 1 element.\n * For now always returns a single element, but it's likely to return a user preference list on some platforms in the future.\n * @example `[\n {\n \"calendar\": \"gregory\",\n \"timeZone\": \"Europe/Warsaw\",\n \"uses24hourClock\": true,\n \"firstWeekday\": 1\n }\n ]`\n */\nexport const getCalendars = ExpoLocalization.getCalendars;\n\n/**\n * A hook providing a list of user's locales, returned as an array of objects of type `Locale`.\n * Guaranteed to contain at least 1 element.\n * These are returned in the order the user defines in their device settings.\n * On the web currency and measurements systems are not provided, instead returned as null.\n * If needed, you can infer them from the current region using a lookup table.\n * If the OS settings change, the hook will rerender with a new list of locales.\n * @example `[{\n \"languageTag\": \"pl-PL\",\n \"languageCode\": \"pl\",\n \"textDirection\": \"ltr\",\n \"digitGroupingSeparator\": \" \",\n \"decimalSeparator\": \",\",\n \"measurementSystem\": \"metric\",\n \"currencyCode\": \"PLN\",\n \"currencySymbol\": \"zł\",\n \"regionCode\": \"PL\",\n \"temperatureUnit\": \"celsius\"\n }]`\n */\nexport function useLocales() {\n const [key, invalidate] = useReducer((k) => k + 1, 0);\n const locales = useMemo(() => getLocales(), [key]);\n useEffect(() => {\n const subscription = addLocaleListener(invalidate);\n return () => {\n removeSubscription(subscription);\n };\n }, []);\n return locales;\n}\n\n/**\n * A hook providing a list of user's preferred calendars, returned as an array of objects of type `Calendar`.\n * Guaranteed to contain at least 1 element.\n * For now always returns a single element, but it's likely to return a user preference list on some platforms in the future.\n * If the OS settings change, the hook will rerender with a new list of calendars.\n * @example `[\n {\n \"calendar\": \"gregory\",\n \"timeZone\": \"Europe/Warsaw\",\n \"uses24hourClock\": true,\n \"firstWeekday\": 1\n }\n ]`\n */\nexport function useCalendars() {\n const [key, invalidate] = useReducer((k) => k + 1, 0);\n const calendars = useMemo(() => getCalendars(), [key]);\n useEffect(() => {\n const subscription = addCalendarListener(invalidate);\n return () => {\n removeSubscription(subscription);\n };\n }, []);\n return calendars;\n}\n\n// @needsAudit\n/**\n * @hidden\n * Get the latest native values from the device. Locale can be changed on some Android devices\n * without resetting the app.\n * > On iOS, changing the locale will cause the device to reset meaning the constants will always be\n * correct.\n *\n * @example\n * ```ts\n * // When the app returns from the background on Android...\n *\n * const { locale } = await Localization.getLocalizationAsync();\n * ```\n * @deprecated\n * Use Localization.getLocales() or Localization.getCalendars() instead.\n */\nexport async function getLocalizationAsync(): Promise<Localization> {\n return await ExpoLocalization.getLocalizationAsync();\n}\n"]}
|
|
@@ -74,7 +74,7 @@ export type Locale = {
|
|
|
74
74
|
* An [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) without the region code.
|
|
75
75
|
* @example `'en'`, `'es'`, `'pl'`.
|
|
76
76
|
*/
|
|
77
|
-
languageCode: string;
|
|
77
|
+
languageCode: string | null;
|
|
78
78
|
/**
|
|
79
79
|
* The region code for your device that comes from the Region setting under Language & Region on iOS, Region settings on Android and is parsed from locale on Web (can be `null` on Web).
|
|
80
80
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Localization.types.d.ts","sourceRoot":"","sources":["../src/Localization.types.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,YAAY,GAAG;IACzB;;;;OAIG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,sBAAsB,EAAE,MAAM,CAAC;IAC/B;;OAEG;IACH,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B;;;OAGG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,KAAK,EAAE,OAAO,CAAC;IACf;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB;;;;;OAKG;IACH,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB;;;;;;;OAOG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IACnB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"Localization.types.d.ts","sourceRoot":"","sources":["../src/Localization.types.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,YAAY,GAAG;IACzB;;;;OAIG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,sBAAsB,EAAE,MAAM,CAAC;IAC/B;;OAEG;IACH,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B;;;OAGG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,KAAK,EAAE,OAAO,CAAC;IACf;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB;;;;;OAKG;IACH,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB;;;;;;;OAOG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IACnB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B;;OAEG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B;;;;OAIG;IACH,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B;;;;OAIG;IACH,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;;;OAGG;IACH,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC;;;OAGG;IACH,sBAAsB,EAAE,MAAM,GAAG,IAAI,CA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;;;OAIG;IACH,YAAY,EAAE,OAAO,GAAG,IAAI,CAAC;IAC7B;;;OAGG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Localization.types.js","sourceRoot":"","sources":["../src/Localization.types.ts"],"names":[],"mappings":"AA2HA;;GAEG;AACH,MAAM,CAAN,IAAY,OAQX;AARD,WAAY,OAAO;IACjB,yCAAU,CAAA;IACV,yCAAU,CAAA;IACV,2CAAW,CAAA;IACX,+CAAa,CAAA;IACb,6CAAY,CAAA;IACZ,yCAAU,CAAA;IACV,6CAAY,CAAA;AACd,CAAC,EARW,OAAO,KAAP,OAAO,QAQlB;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,kBAuCX;AAvCD,WAAY,kBAAkB;IAC5B,6BAA6B;IAC7B,2CAAqB,CAAA;IACrB,mCAAmC;IACnC,yCAAmB,CAAA;IACnB,sBAAsB;IACtB,uCAAiB,CAAA;IACjB,kCAAkC;IAClC,qCAAe,CAAA;IACf,+DAA+D;IAC/D,yCAAmB,CAAA;IACnB,6DAA6D;IAC7D,2CAAqB,CAAA;IACrB,yBAAyB;IACzB,yCAAmB,CAAA;IACnB,iCAAiC;IACjC,2CAAqB,CAAA;IACrB,kCAAkC;IAClC,uCAAiB,CAAA;IACjB,sBAAsB;IACtB,uCAAiB,CAAA;IACjB,uBAAuB;IACvB,yCAAmB,CAAA;IACnB,kGAAkG;IAClG,qDAA+B,CAAA;IAC/B,8CAA8C;IAC9C,mDAA6B,CAAA;IAC7B,wGAAwG;IACxG,mDAA6B,CAAA;IAC7B,oCAAoC;IACpC,2DAAqC,CAAA;IACrC,+EAA+E;IAC/E,yCAAmB,CAAA;IACnB,iCAAiC;IACjC,2CAAqB,CAAA;IACrB,uBAAuB;IACvB,yCAAmB,CAAA;IACnB,0CAA0C;IAC1C,iCAAW,CAAA;AACb,CAAC,EAvCW,kBAAkB,KAAlB,kBAAkB,QAuC7B","sourcesContent":["// @needsAudit\nexport type Localization = {\n /**\n * Three-character ISO 4217 currency code. Returns `null` on web.\n *\n * @example `'USD'`, `'EUR'`, `'CNY'`, `null`\n */\n currency: string | null;\n /**\n * Decimal separator used for formatting numbers.\n *\n * @example `','`, `'.'`\n */\n decimalSeparator: string;\n /**\n * Digit grouping separator used when formatting numbers larger than 1000.\n *\n * @example `'.'`, `''`, `','`\n */\n digitGroupingSeparator: string;\n /**\n * A list of all the supported language ISO codes.\n */\n isoCurrencyCodes: string[];\n /**\n * Boolean value that indicates whether the system uses the metric system.\n * On Android and web, this is inferred from the current region.\n */\n isMetric: boolean;\n /**\n * Returns if the system's language is written from Right-to-Left.\n * This can be used to build features like [bidirectional icons](https://material.io/design/usability/bidirectionality.html).\n *\n * Returns `false` in Server Side Rendering (SSR) environments.\n */\n isRTL: boolean;\n /**\n * An [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag),\n * consisting of a two-character language code and optional script, region and variant codes.\n *\n * @example `'en'`, `'en-US'`, `'zh-Hans'`, `'zh-Hans-CN'`, `'en-emodeng'`\n */\n locale: string;\n /**\n * List of all the native languages provided by the user settings.\n * These are returned in the order that the user defined in the device settings.\n *\n * @example `['en', 'en-US', 'zh-Hans', 'zh-Hans-CN', 'en-emodeng']`\n */\n locales: string[];\n /**\n * The region code for your device that comes from the Region setting under Language & Region on iOS.\n * This value is always available on iOS, but might return `null` on Android or web.\n *\n * @example `'US'`, `'NZ'`, `null`\n */\n region: string | null;\n /**\n * The current time zone in display format.\n * On Web time zone is calculated with Intl.DateTimeFormat().resolvedOptions().timeZone. For a\n * better estimation you could use the moment-timezone package but it will add significant bloat to\n * your website's bundle size.\n *\n * @example `'America/Los_Angeles'`\n */\n timezone: string;\n};\n\nexport type Locale = {\n /**\n * An [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) with a region code.\n * @example `'en-US'`, `'es-419'`, `'pl-PL'`.\n */\n languageTag: string;\n /**\n * An [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) without the region code.\n * @example `'en'`, `'es'`, `'pl'`.\n */\n languageCode: string;\n /**\n * The region code for your device that comes from the Region setting under Language & Region on iOS, Region settings on Android and is parsed from locale on Web (can be `null` on Web).\n */\n regionCode: string | null;\n /**\n * Currency code for the locale.\n * Is `null` on Web, use a table lookup based on region instead.\n * @example `'USD'`, `'EUR'`, `'PLN'`.\n */\n currencyCode: string | null;\n /**\n * Currency symbol for the locale.\n * Is `null` on Web, use a table lookup based on region (if available) instead.\n * @example `'$'`, `'€'`, `'zł'`.\n */\n currencySymbol: string | null;\n /**\n * Decimal separator used for formatting numbers with fractional parts.\n * @example `'.'`, `','`.\n */\n decimalSeparator: string | null;\n /**\n * Digit grouping separator used for formatting large numbers.\n * @example `'.'`, `','`.\n */\n digitGroupingSeparator: string | null;\n /**\n * Text direction for the locale. One of: `'ltr'`, `'rtl'`, but can also be `null` on some browsers without support for the [textInfo](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/textInfo) property in [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl) API.\n */\n textDirection: 'ltr' | 'rtl' | null;\n /**\n * The measurement system used in the locale.\n * Is `null` on Web, as user chosen measurement system is not exposed on the web and using locale to determine measurement systems is unreliable.\n * Ask for user preferences if possible.\n */\n measurementSystem: `metric` | `us` | `uk` | null;\n\n /**\n * The temperature unit used in the locale.\n * Returns `null` if the region code is unknown.\n */\n temperatureUnit: 'celsius' | 'fahrenheit' | null;\n};\n\n/**\n * An enum mapping days of the week in Gregorian calendar to their index as returned by the `firstWeekday` property.\n */\nexport enum Weekday {\n SUNDAY = 1,\n MONDAY = 2,\n TUESDAY = 3,\n WEDNESDAY = 4,\n THURSDAY = 5,\n FRIDAY = 6,\n SATURDAY = 7,\n}\n\n/**\n * The calendar identifier, one of [Unicode calendar types](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/calendar).\n * Gregorian calendar is aliased and can be referred to as both `CalendarIdentifier.GREGORIAN` and `CalendarIdentifier.GREGORY`.\n */\nexport enum CalendarIdentifier {\n /** Thai Buddhist calendar */\n BUDDHIST = 'buddhist',\n /** Traditional Chinese calendar */\n CHINESE = 'chinese',\n /** Coptic calendar */\n COPTIC = 'coptic',\n /** Traditional Korean calendar */\n DANGI = 'dangi',\n /** Ethiopic calendar, Amete Alem (epoch approx. 5493 B.C.E) */\n ETHIOAA = 'ethioaa',\n /** Ethiopic calendar, Amete Mihret (epoch approx, 8 C.E.) */\n ETHIOPIC = 'ethiopic',\n /** Gregorian calendar */\n GREGORY = 'gregory',\n /** Gregorian calendar (alias) */\n GREGORIAN = 'gregory',\n /** Traditional Hebrew calendar */\n HEBREW = 'hebrew',\n /** Indian calendar */\n INDIAN = 'indian',\n /** Islamic calendar */\n ISLAMIC = 'islamic',\n /** Islamic calendar, tabular (intercalary years [2,5,7,10,13,16,18,21,24,26,29] - civil epoch) */\n ISLAMIC_CIVIL = 'islamic-civil',\n /** Islamic calendar, Saudi Arabia sighting */\n ISLAMIC_RGSA = 'islamic-rgsa',\n /**Islamic calendar, tabular (intercalary years [2,5,7,10,13,16,18,21,24,26,29] - astronomical epoch) */\n ISLAMIC_TBLA = 'islamic-tbla',\n /** Islamic calendar, Umm al-Qura */\n ISLAMIC_UMALQURA = 'islamic-umalqura',\n /** ISO calendar (Gregorian calendar using the ISO 8601 calendar week rules) */\n ISO8601 = 'iso8601',\n /** Japanese imperial calendar */\n JAPANESE = 'japanese',\n /** Persian calendar */\n PERSIAN = 'persian',\n /** Civil (algorithmic) Arabic calendar */\n ROC = 'roc',\n}\n\nexport type Calendar = {\n /**\n * The calendar identifier, one of [Unicode calendar types](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/calendar).\n *\n * On Android is limited to one of device's [available calendar types](https://developer.android.com/reference/java/util/Calendar#getAvailableCalendarTypes()).\n *\n * On iOS uses [calendar identifiers](https://developer.apple.com/documentation/foundation/calendar/identifier), but maps them to the corresponding Unicode types, will also never contain `'dangi'` or `'islamic-rgsa'` due to it not being implemented on iOS.\n */\n calendar: CalendarIdentifier | null;\n /**\n * True when current device settings use 24 hour time format.\n * Can be null on some browsers that don't support the [hourCycle](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/hourCycle) property in [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl) API.\n */\n uses24hourClock: boolean | null;\n /**\n * The first day of the week. For most calendars Sunday is numbered `1`, with Saturday being number `7`.\n * Can be null on some browsers that don't support the [weekInfo](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/weekInfo) property in [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl) API.\n * @example `1`, `7`.\n */\n firstWeekday: Weekday | null;\n /**\n * Time zone for the calendar. Can be `null` on Web.\n * @example `'America/Los_Angeles'`, `'Europe/Warsaw'`, `'GMT+1'`.\n */\n timeZone: string | null;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"Localization.types.js","sourceRoot":"","sources":["../src/Localization.types.ts"],"names":[],"mappings":"AA2HA;;GAEG;AACH,MAAM,CAAN,IAAY,OAQX;AARD,WAAY,OAAO;IACjB,yCAAU,CAAA;IACV,yCAAU,CAAA;IACV,2CAAW,CAAA;IACX,+CAAa,CAAA;IACb,6CAAY,CAAA;IACZ,yCAAU,CAAA;IACV,6CAAY,CAAA;AACd,CAAC,EARW,OAAO,KAAP,OAAO,QAQlB;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,kBAuCX;AAvCD,WAAY,kBAAkB;IAC5B,6BAA6B;IAC7B,2CAAqB,CAAA;IACrB,mCAAmC;IACnC,yCAAmB,CAAA;IACnB,sBAAsB;IACtB,uCAAiB,CAAA;IACjB,kCAAkC;IAClC,qCAAe,CAAA;IACf,+DAA+D;IAC/D,yCAAmB,CAAA;IACnB,6DAA6D;IAC7D,2CAAqB,CAAA;IACrB,yBAAyB;IACzB,yCAAmB,CAAA;IACnB,iCAAiC;IACjC,2CAAqB,CAAA;IACrB,kCAAkC;IAClC,uCAAiB,CAAA;IACjB,sBAAsB;IACtB,uCAAiB,CAAA;IACjB,uBAAuB;IACvB,yCAAmB,CAAA;IACnB,kGAAkG;IAClG,qDAA+B,CAAA;IAC/B,8CAA8C;IAC9C,mDAA6B,CAAA;IAC7B,wGAAwG;IACxG,mDAA6B,CAAA;IAC7B,oCAAoC;IACpC,2DAAqC,CAAA;IACrC,+EAA+E;IAC/E,yCAAmB,CAAA;IACnB,iCAAiC;IACjC,2CAAqB,CAAA;IACrB,uBAAuB;IACvB,yCAAmB,CAAA;IACnB,0CAA0C;IAC1C,iCAAW,CAAA;AACb,CAAC,EAvCW,kBAAkB,KAAlB,kBAAkB,QAuC7B","sourcesContent":["// @needsAudit\nexport type Localization = {\n /**\n * Three-character ISO 4217 currency code. Returns `null` on web.\n *\n * @example `'USD'`, `'EUR'`, `'CNY'`, `null`\n */\n currency: string | null;\n /**\n * Decimal separator used for formatting numbers.\n *\n * @example `','`, `'.'`\n */\n decimalSeparator: string;\n /**\n * Digit grouping separator used when formatting numbers larger than 1000.\n *\n * @example `'.'`, `''`, `','`\n */\n digitGroupingSeparator: string;\n /**\n * A list of all the supported language ISO codes.\n */\n isoCurrencyCodes: string[];\n /**\n * Boolean value that indicates whether the system uses the metric system.\n * On Android and web, this is inferred from the current region.\n */\n isMetric: boolean;\n /**\n * Returns if the system's language is written from Right-to-Left.\n * This can be used to build features like [bidirectional icons](https://material.io/design/usability/bidirectionality.html).\n *\n * Returns `false` in Server Side Rendering (SSR) environments.\n */\n isRTL: boolean;\n /**\n * An [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag),\n * consisting of a two-character language code and optional script, region and variant codes.\n *\n * @example `'en'`, `'en-US'`, `'zh-Hans'`, `'zh-Hans-CN'`, `'en-emodeng'`\n */\n locale: string;\n /**\n * List of all the native languages provided by the user settings.\n * These are returned in the order that the user defined in the device settings.\n *\n * @example `['en', 'en-US', 'zh-Hans', 'zh-Hans-CN', 'en-emodeng']`\n */\n locales: string[];\n /**\n * The region code for your device that comes from the Region setting under Language & Region on iOS.\n * This value is always available on iOS, but might return `null` on Android or web.\n *\n * @example `'US'`, `'NZ'`, `null`\n */\n region: string | null;\n /**\n * The current time zone in display format.\n * On Web time zone is calculated with Intl.DateTimeFormat().resolvedOptions().timeZone. For a\n * better estimation you could use the moment-timezone package but it will add significant bloat to\n * your website's bundle size.\n *\n * @example `'America/Los_Angeles'`\n */\n timezone: string;\n};\n\nexport type Locale = {\n /**\n * An [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) with a region code.\n * @example `'en-US'`, `'es-419'`, `'pl-PL'`.\n */\n languageTag: string;\n /**\n * An [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) without the region code.\n * @example `'en'`, `'es'`, `'pl'`.\n */\n languageCode: string | null;\n /**\n * The region code for your device that comes from the Region setting under Language & Region on iOS, Region settings on Android and is parsed from locale on Web (can be `null` on Web).\n */\n regionCode: string | null;\n /**\n * Currency code for the locale.\n * Is `null` on Web, use a table lookup based on region instead.\n * @example `'USD'`, `'EUR'`, `'PLN'`.\n */\n currencyCode: string | null;\n /**\n * Currency symbol for the locale.\n * Is `null` on Web, use a table lookup based on region (if available) instead.\n * @example `'$'`, `'€'`, `'zł'`.\n */\n currencySymbol: string | null;\n /**\n * Decimal separator used for formatting numbers with fractional parts.\n * @example `'.'`, `','`.\n */\n decimalSeparator: string | null;\n /**\n * Digit grouping separator used for formatting large numbers.\n * @example `'.'`, `','`.\n */\n digitGroupingSeparator: string | null;\n /**\n * Text direction for the locale. One of: `'ltr'`, `'rtl'`, but can also be `null` on some browsers without support for the [textInfo](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/textInfo) property in [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl) API.\n */\n textDirection: 'ltr' | 'rtl' | null;\n /**\n * The measurement system used in the locale.\n * Is `null` on Web, as user chosen measurement system is not exposed on the web and using locale to determine measurement systems is unreliable.\n * Ask for user preferences if possible.\n */\n measurementSystem: `metric` | `us` | `uk` | null;\n\n /**\n * The temperature unit used in the locale.\n * Returns `null` if the region code is unknown.\n */\n temperatureUnit: 'celsius' | 'fahrenheit' | null;\n};\n\n/**\n * An enum mapping days of the week in Gregorian calendar to their index as returned by the `firstWeekday` property.\n */\nexport enum Weekday {\n SUNDAY = 1,\n MONDAY = 2,\n TUESDAY = 3,\n WEDNESDAY = 4,\n THURSDAY = 5,\n FRIDAY = 6,\n SATURDAY = 7,\n}\n\n/**\n * The calendar identifier, one of [Unicode calendar types](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/calendar).\n * Gregorian calendar is aliased and can be referred to as both `CalendarIdentifier.GREGORIAN` and `CalendarIdentifier.GREGORY`.\n */\nexport enum CalendarIdentifier {\n /** Thai Buddhist calendar */\n BUDDHIST = 'buddhist',\n /** Traditional Chinese calendar */\n CHINESE = 'chinese',\n /** Coptic calendar */\n COPTIC = 'coptic',\n /** Traditional Korean calendar */\n DANGI = 'dangi',\n /** Ethiopic calendar, Amete Alem (epoch approx. 5493 B.C.E) */\n ETHIOAA = 'ethioaa',\n /** Ethiopic calendar, Amete Mihret (epoch approx, 8 C.E.) */\n ETHIOPIC = 'ethiopic',\n /** Gregorian calendar */\n GREGORY = 'gregory',\n /** Gregorian calendar (alias) */\n GREGORIAN = 'gregory',\n /** Traditional Hebrew calendar */\n HEBREW = 'hebrew',\n /** Indian calendar */\n INDIAN = 'indian',\n /** Islamic calendar */\n ISLAMIC = 'islamic',\n /** Islamic calendar, tabular (intercalary years [2,5,7,10,13,16,18,21,24,26,29] - civil epoch) */\n ISLAMIC_CIVIL = 'islamic-civil',\n /** Islamic calendar, Saudi Arabia sighting */\n ISLAMIC_RGSA = 'islamic-rgsa',\n /**Islamic calendar, tabular (intercalary years [2,5,7,10,13,16,18,21,24,26,29] - astronomical epoch) */\n ISLAMIC_TBLA = 'islamic-tbla',\n /** Islamic calendar, Umm al-Qura */\n ISLAMIC_UMALQURA = 'islamic-umalqura',\n /** ISO calendar (Gregorian calendar using the ISO 8601 calendar week rules) */\n ISO8601 = 'iso8601',\n /** Japanese imperial calendar */\n JAPANESE = 'japanese',\n /** Persian calendar */\n PERSIAN = 'persian',\n /** Civil (algorithmic) Arabic calendar */\n ROC = 'roc',\n}\n\nexport type Calendar = {\n /**\n * The calendar identifier, one of [Unicode calendar types](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/calendar).\n *\n * On Android is limited to one of device's [available calendar types](https://developer.android.com/reference/java/util/Calendar#getAvailableCalendarTypes()).\n *\n * On iOS uses [calendar identifiers](https://developer.apple.com/documentation/foundation/calendar/identifier), but maps them to the corresponding Unicode types, will also never contain `'dangi'` or `'islamic-rgsa'` due to it not being implemented on iOS.\n */\n calendar: CalendarIdentifier | null;\n /**\n * True when current device settings use 24 hour time format.\n * Can be null on some browsers that don't support the [hourCycle](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/hourCycle) property in [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl) API.\n */\n uses24hourClock: boolean | null;\n /**\n * The first day of the week. For most calendars Sunday is numbered `1`, with Saturday being number `7`.\n * Can be null on some browsers that don't support the [weekInfo](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/weekInfo) property in [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl) API.\n * @example `1`, `7`.\n */\n firstWeekday: Weekday | null;\n /**\n * Time zone for the calendar. Can be `null` on Web.\n * @example `'America/Los_Angeles'`, `'Europe/Warsaw'`, `'GMT+1'`.\n */\n timeZone: string | null;\n};\n"]}
|
|
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
|
|
|
10
10
|
s.license = package['license']
|
|
11
11
|
s.author = package['author']
|
|
12
12
|
s.homepage = package['homepage']
|
|
13
|
-
s.
|
|
13
|
+
s.platforms = { :ios => '13.4', :tvos => '13.4' }
|
|
14
14
|
s.swift_version = '5.4'
|
|
15
15
|
s.source = { git: 'https://github.com/expo/expo.git' }
|
|
16
16
|
s.static_framework = true
|
|
@@ -115,7 +115,7 @@ public class LocalizationModule: Module {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
static func getMeasurementSystemForLocale(_ locale: Locale) -> String {
|
|
118
|
-
if #available(iOS 16, *) {
|
|
118
|
+
if #available(iOS 16, tvOS 16, *) {
|
|
119
119
|
let measurementSystems = [
|
|
120
120
|
Locale.MeasurementSystem.us: "us",
|
|
121
121
|
Locale.MeasurementSystem.uk: "uk",
|
|
@@ -133,6 +133,20 @@ public class LocalizationModule: Module {
|
|
|
133
133
|
.map { languageTag -> [String: Any?] in
|
|
134
134
|
let languageLocale = Locale.init(identifier: languageTag)
|
|
135
135
|
|
|
136
|
+
if #available(iOS 16, tvOS 16, *) {
|
|
137
|
+
return [
|
|
138
|
+
"languageTag": languageTag,
|
|
139
|
+
"languageCode": languageLocale.language.languageCode?.identifier,
|
|
140
|
+
"regionCode": languageLocale.region?.identifier,
|
|
141
|
+
"textDirection": languageLocale.language.characterDirection == .rightToLeft ? "rtl" : "ltr",
|
|
142
|
+
"decimalSeparator": userSettingsLocale.decimalSeparator,
|
|
143
|
+
"digitGroupingSeparator": userSettingsLocale.groupingSeparator,
|
|
144
|
+
"measurementSystem": getMeasurementSystemForLocale(userSettingsLocale),
|
|
145
|
+
"currencyCode": languageLocale.currencyCode,
|
|
146
|
+
"currencySymbol": languageLocale.currencySymbol,
|
|
147
|
+
"temperatureUnit": getTemperatureUnit()
|
|
148
|
+
]
|
|
149
|
+
}
|
|
136
150
|
return [
|
|
137
151
|
"languageTag": languageTag,
|
|
138
152
|
"languageCode": languageLocale.languageCode,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-localization",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.7.0",
|
|
4
4
|
"description": "Provides an interface for native user localization information.",
|
|
5
5
|
"main": "build/Localization.js",
|
|
6
6
|
"types": "build/Localization.d.ts",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"expo": "*"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "3142a086578deffd8704a8f1b6f0f661527d836c"
|
|
51
51
|
}
|
package/src/Localization.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from './Localization.types';
|
|
|
10
10
|
|
|
11
11
|
// @needsAudit
|
|
12
12
|
/**
|
|
13
|
+
* @hidden
|
|
13
14
|
* @deprecated Use Localization.getLocales() instead.
|
|
14
15
|
* Three-character ISO 4217 currency code. Returns `null` on web.
|
|
15
16
|
*
|
|
@@ -19,6 +20,7 @@ export const currency = ExpoLocalization.currency;
|
|
|
19
20
|
|
|
20
21
|
// @needsAudit
|
|
21
22
|
/**
|
|
23
|
+
* @hidden
|
|
22
24
|
* @deprecated Use Localization.getLocales() instead.
|
|
23
25
|
* Decimal separator used for formatting numbers.
|
|
24
26
|
*
|
|
@@ -28,6 +30,7 @@ export const decimalSeparator = ExpoLocalization.decimalSeparator;
|
|
|
28
30
|
|
|
29
31
|
// @needsAudit
|
|
30
32
|
/**
|
|
33
|
+
* @hidden
|
|
31
34
|
* @deprecated Use Localization.getLocales() instead.
|
|
32
35
|
* Digit grouping separator used when formatting numbers larger than 1000.
|
|
33
36
|
*
|
|
@@ -37,6 +40,7 @@ export const digitGroupingSeparator = ExpoLocalization.digitGroupingSeparator;
|
|
|
37
40
|
|
|
38
41
|
// @needsAudit
|
|
39
42
|
/**
|
|
43
|
+
* @hidden
|
|
40
44
|
* @deprecated Use Localization.getLocales() instead.
|
|
41
45
|
* A list of all the supported language ISO codes.
|
|
42
46
|
*/
|
|
@@ -44,6 +48,7 @@ export const isoCurrencyCodes = ExpoLocalization.isoCurrencyCodes;
|
|
|
44
48
|
|
|
45
49
|
// @needsAudit
|
|
46
50
|
/**
|
|
51
|
+
* @hidden
|
|
47
52
|
* @deprecated Use Localization.getLocales() instead.
|
|
48
53
|
* Boolean value that indicates whether the system uses the metric system.
|
|
49
54
|
* On Android and web, this is inferred from the current region.
|
|
@@ -52,6 +57,7 @@ export const isMetric = ExpoLocalization.isMetric;
|
|
|
52
57
|
|
|
53
58
|
// @needsAudit
|
|
54
59
|
/**
|
|
60
|
+
* @hidden
|
|
55
61
|
* @deprecated Use Localization.getLocales() instead.
|
|
56
62
|
* Returns if the system's language is written from Right-to-Left.
|
|
57
63
|
* This can be used to build features like [bidirectional icons](https://material.io/design/usability/bidirectionality.html).
|
|
@@ -62,7 +68,7 @@ export const isRTL = ExpoLocalization.isRTL;
|
|
|
62
68
|
|
|
63
69
|
// @needsAudit
|
|
64
70
|
/**
|
|
65
|
-
*
|
|
71
|
+
* @deprecated Use [`Localization.getLocales()`](#localizationgetlocales) instead.
|
|
66
72
|
* An [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag),
|
|
67
73
|
* consisting of a two-character language code and optional script, region and variant codes.
|
|
68
74
|
*
|
|
@@ -72,6 +78,7 @@ export const locale = ExpoLocalization.locale;
|
|
|
72
78
|
|
|
73
79
|
// @needsAudit
|
|
74
80
|
/**
|
|
81
|
+
* @hidden
|
|
75
82
|
* @deprecated Use Localization.getLocales() instead.
|
|
76
83
|
* List of all the native languages provided by the user settings.
|
|
77
84
|
* These are returned in the order the user defines in their device settings.
|
|
@@ -82,6 +89,7 @@ export const locales = ExpoLocalization.locales;
|
|
|
82
89
|
|
|
83
90
|
// @needsAudit
|
|
84
91
|
/**
|
|
92
|
+
* @hidden
|
|
85
93
|
* @deprecated Use Localization.getCalendars() instead.
|
|
86
94
|
* The current time zone in display format.
|
|
87
95
|
* On Web time zone is calculated with Intl.DateTimeFormat().resolvedOptions().timeZone. For a
|
|
@@ -94,6 +102,7 @@ export const timezone = ExpoLocalization.timezone;
|
|
|
94
102
|
|
|
95
103
|
// @needsAudit
|
|
96
104
|
/**
|
|
105
|
+
* @hidden
|
|
97
106
|
* @deprecated Use Localization.getLocales() instead.
|
|
98
107
|
* The region code for your device that comes from the Region setting under Language & Region on iOS.
|
|
99
108
|
* This value is always available on iOS, but might return `null` on Android or web.
|
|
@@ -198,6 +207,7 @@ export function useCalendars() {
|
|
|
198
207
|
|
|
199
208
|
// @needsAudit
|
|
200
209
|
/**
|
|
210
|
+
* @hidden
|
|
201
211
|
* Get the latest native values from the device. Locale can be changed on some Android devices
|
|
202
212
|
* without resetting the app.
|
|
203
213
|
* > On iOS, changing the locale will cause the device to reset meaning the constants will always be
|
|
@@ -76,7 +76,7 @@ export type Locale = {
|
|
|
76
76
|
* An [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) without the region code.
|
|
77
77
|
* @example `'en'`, `'es'`, `'pl'`.
|
|
78
78
|
*/
|
|
79
|
-
languageCode: string;
|
|
79
|
+
languageCode: string | null;
|
|
80
80
|
/**
|
|
81
81
|
* The region code for your device that comes from the Region setting under Language & Region on iOS, Region settings on Android and is parsed from locale on Web (can be `null` on Web).
|
|
82
82
|
*/
|