gt-react-native 10.19.16 → 10.19.17
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/dist/commonjs/NativeGtReactNative.js +9 -7
- package/dist/commonjs/NativeGtReactNative.js.map +1 -1
- package/dist/commonjs/_virtual/_rolldown/runtime.js +23 -0
- package/dist/commonjs/errors-dir/constants.js +5 -6
- package/dist/commonjs/errors-dir/constants.js.map +1 -1
- package/dist/commonjs/errors-dir/errors.js +12 -7
- package/dist/commonjs/errors-dir/errors.js.map +1 -1
- package/dist/commonjs/errors-dir/warnings.js +34 -15
- package/dist/commonjs/errors-dir/warnings.js.map +1 -1
- package/dist/commonjs/index.js +35 -194
- package/dist/commonjs/internal.js +3 -13
- package/dist/commonjs/plugin-dir/index.js +35 -51
- package/dist/commonjs/plugin-dir/index.js.map +1 -1
- package/dist/commonjs/plugin-dir/types.js +24 -9
- package/dist/commonjs/plugin-dir/types.js.map +1 -1
- package/dist/commonjs/plugin-dir/utils/resolveLocales.js +52 -69
- package/dist/commonjs/plugin-dir/utils/resolveLocales.js.map +1 -1
- package/dist/commonjs/plugin.js +5 -13
- package/dist/commonjs/provider/GTProvider.js +22 -20
- package/dist/commonjs/provider/GTProvider.js.map +1 -1
- package/dist/commonjs/provider/hooks/locale/useDetermineLocale.js +96 -160
- package/dist/commonjs/provider/hooks/locale/useDetermineLocale.js.map +1 -1
- package/dist/commonjs/provider/hooks/useRegionState.js +32 -44
- package/dist/commonjs/provider/hooks/useRegionState.js.map +1 -1
- package/dist/commonjs/tools/testLocalePolyfill.js +125 -146
- package/dist/commonjs/tools/testLocalePolyfill.js.map +1 -1
- package/dist/commonjs/types/config.js +1 -6
- package/dist/commonjs/utils/getNativeLocales.js +36 -54
- package/dist/commonjs/utils/getNativeLocales.js.map +1 -1
- package/dist/commonjs/utils/nativeStore.js +37 -42
- package/dist/commonjs/utils/nativeStore.js.map +1 -1
- package/dist/commonjs/utils/utils.js +10 -14
- package/dist/commonjs/utils/utils.js.map +1 -1
- package/dist/module/NativeGtReactNative.d.ts.map +1 -0
- package/dist/module/NativeGtReactNative.js +5 -3
- package/dist/module/NativeGtReactNative.js.map +1 -1
- package/dist/module/errors-dir/constants.d.ts.map +1 -0
- package/dist/module/errors-dir/constants.js +4 -2
- package/dist/module/errors-dir/constants.js.map +1 -1
- package/dist/module/errors-dir/errors.d.ts.map +1 -0
- package/dist/module/errors-dir/errors.js +11 -3
- package/dist/module/errors-dir/errors.js.map +1 -1
- package/dist/{typescript/commonjs/src → module}/errors-dir/warnings.d.ts +1 -1
- package/dist/module/errors-dir/warnings.d.ts.map +1 -0
- package/dist/module/errors-dir/warnings.js +31 -11
- package/dist/module/errors-dir/warnings.js.map +1 -1
- package/dist/module/index.d.ts.map +1 -0
- package/dist/module/index.js +2 -5
- package/dist/module/internal.d.ts.map +1 -0
- package/dist/module/internal.js +2 -4
- package/dist/module/plugin-dir/index.d.ts.map +1 -0
- package/dist/module/plugin-dir/index.js +28 -45
- package/dist/module/plugin-dir/index.js.map +1 -1
- package/dist/module/plugin-dir/types.d.ts.map +1 -0
- package/dist/module/plugin-dir/types.js +22 -5
- package/dist/module/plugin-dir/types.js.map +1 -1
- package/dist/module/plugin-dir/utils/resolveLocales.d.ts.map +1 -0
- package/dist/module/plugin-dir/utils/resolveLocales.js +46 -62
- package/dist/module/plugin-dir/utils/resolveLocales.js.map +1 -1
- package/dist/module/plugin.d.ts.map +1 -0
- package/dist/module/plugin.js +2 -4
- package/dist/module/provider/GTProvider.d.ts.map +1 -0
- package/dist/module/provider/GTProvider.js +15 -14
- package/dist/module/provider/GTProvider.js.map +1 -1
- package/dist/module/provider/hooks/locale/useDetermineLocale.d.ts.map +1 -0
- package/dist/module/provider/hooks/locale/useDetermineLocale.js +91 -153
- package/dist/module/provider/hooks/locale/useDetermineLocale.js.map +1 -1
- package/dist/module/provider/hooks/useRegionState.d.ts.map +1 -0
- package/dist/module/provider/hooks/useRegionState.js +29 -39
- package/dist/module/provider/hooks/useRegionState.js.map +1 -1
- package/dist/module/tools/testLocalePolyfill.d.ts.map +1 -0
- package/dist/module/tools/testLocalePolyfill.js +124 -143
- package/dist/module/tools/testLocalePolyfill.js.map +1 -1
- package/dist/module/types/config.d.ts.map +1 -0
- package/dist/module/types/config.js +0 -3
- package/dist/module/utils/getNativeLocales.d.ts.map +1 -0
- package/dist/module/utils/getNativeLocales.js +35 -51
- package/dist/module/utils/getNativeLocales.js.map +1 -1
- package/dist/module/utils/nativeStore.d.ts.map +1 -0
- package/dist/module/utils/nativeStore.js +35 -38
- package/dist/module/utils/nativeStore.js.map +1 -1
- package/dist/module/utils/utils.d.ts.map +1 -0
- package/dist/module/utils/utils.js +10 -11
- package/dist/module/utils/utils.js.map +1 -1
- package/package.json +15 -37
- package/src/errors-dir/errors.ts +8 -1
- package/src/errors-dir/warnings.ts +30 -9
- package/dist/commonjs/index.js.map +0 -1
- package/dist/commonjs/internal.js.map +0 -1
- package/dist/commonjs/package.json +0 -1
- package/dist/commonjs/plugin.js.map +0 -1
- package/dist/commonjs/types/config.js.map +0 -1
- package/dist/module/index.js.map +0 -1
- package/dist/module/internal.js.map +0 -1
- package/dist/module/package.json +0 -1
- package/dist/module/plugin.js.map +0 -1
- package/dist/module/types/config.js.map +0 -1
- package/dist/typescript/commonjs/package.json +0 -1
- package/dist/typescript/commonjs/src/NativeGtReactNative.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/errors-dir/constants.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/errors-dir/errors.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/errors-dir/warnings.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/index.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/internal.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/plugin-dir/index.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/plugin-dir/types.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/plugin-dir/utils/resolveLocales.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/plugin.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/provider/GTProvider.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/provider/hooks/locale/useDetermineLocale.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/provider/hooks/useRegionState.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/tools/testLocalePolyfill.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/types/config.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/utils/getNativeLocales.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/utils/nativeStore.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/utils/utils.d.ts.map +0 -1
- package/dist/typescript/module/package.json +0 -1
- package/dist/typescript/module/src/NativeGtReactNative.d.ts +0 -10
- package/dist/typescript/module/src/NativeGtReactNative.d.ts.map +0 -1
- package/dist/typescript/module/src/errors-dir/constants.d.ts +0 -2
- package/dist/typescript/module/src/errors-dir/constants.d.ts.map +0 -1
- package/dist/typescript/module/src/errors-dir/errors.d.ts +0 -2
- package/dist/typescript/module/src/errors-dir/errors.d.ts.map +0 -1
- package/dist/typescript/module/src/errors-dir/warnings.d.ts +0 -5
- package/dist/typescript/module/src/errors-dir/warnings.d.ts.map +0 -1
- package/dist/typescript/module/src/index.d.ts +0 -5
- package/dist/typescript/module/src/index.d.ts.map +0 -1
- package/dist/typescript/module/src/internal.d.ts +0 -2
- package/dist/typescript/module/src/internal.d.ts.map +0 -1
- package/dist/typescript/module/src/plugin-dir/index.d.ts +0 -6
- package/dist/typescript/module/src/plugin-dir/index.d.ts.map +0 -1
- package/dist/typescript/module/src/plugin-dir/types.d.ts +0 -13
- package/dist/typescript/module/src/plugin-dir/types.d.ts.map +0 -1
- package/dist/typescript/module/src/plugin-dir/utils/resolveLocales.d.ts +0 -13
- package/dist/typescript/module/src/plugin-dir/utils/resolveLocales.d.ts.map +0 -1
- package/dist/typescript/module/src/plugin.d.ts +0 -2
- package/dist/typescript/module/src/plugin.d.ts.map +0 -1
- package/dist/typescript/module/src/provider/GTProvider.d.ts +0 -4
- package/dist/typescript/module/src/provider/GTProvider.d.ts.map +0 -1
- package/dist/typescript/module/src/provider/hooks/locale/useDetermineLocale.d.ts +0 -4
- package/dist/typescript/module/src/provider/hooks/locale/useDetermineLocale.d.ts.map +0 -1
- package/dist/typescript/module/src/provider/hooks/useRegionState.d.ts +0 -3
- package/dist/typescript/module/src/provider/hooks/useRegionState.d.ts.map +0 -1
- package/dist/typescript/module/src/tools/testLocalePolyfill.d.ts +0 -8
- package/dist/typescript/module/src/tools/testLocalePolyfill.d.ts.map +0 -1
- package/dist/typescript/module/src/types/config.d.ts +0 -30
- package/dist/typescript/module/src/types/config.d.ts.map +0 -1
- package/dist/typescript/module/src/utils/getNativeLocales.d.ts +0 -10
- package/dist/typescript/module/src/utils/getNativeLocales.d.ts.map +0 -1
- package/dist/typescript/module/src/utils/nativeStore.d.ts +0 -16
- package/dist/typescript/module/src/utils/nativeStore.d.ts.map +0 -1
- package/dist/typescript/module/src/utils/utils.d.ts +0 -3
- package/dist/typescript/module/src/utils/utils.d.ts.map +0 -1
- /package/dist/{typescript/commonjs/src → module}/NativeGtReactNative.d.ts +0 -0
- /package/dist/{typescript/commonjs/src → module}/errors-dir/constants.d.ts +0 -0
- /package/dist/{typescript/commonjs/src → module}/errors-dir/errors.d.ts +0 -0
- /package/dist/{typescript/commonjs/src → module}/index.d.ts +0 -0
- /package/dist/{typescript/commonjs/src → module}/internal.d.ts +0 -0
- /package/dist/{typescript/commonjs/src → module}/plugin-dir/index.d.ts +0 -0
- /package/dist/{typescript/commonjs/src → module}/plugin-dir/types.d.ts +0 -0
- /package/dist/{typescript/commonjs/src → module}/plugin-dir/utils/resolveLocales.d.ts +0 -0
- /package/dist/{typescript/commonjs/src → module}/plugin.d.ts +0 -0
- /package/dist/{typescript/commonjs/src → module}/provider/GTProvider.d.ts +0 -0
- /package/dist/{typescript/commonjs/src → module}/provider/hooks/locale/useDetermineLocale.d.ts +0 -0
- /package/dist/{typescript/commonjs/src → module}/provider/hooks/useRegionState.d.ts +0 -0
- /package/dist/{typescript/commonjs/src → module}/tools/testLocalePolyfill.d.ts +0 -0
- /package/dist/{typescript/commonjs/src → module}/types/config.d.ts +0 -0
- /package/dist/{typescript/commonjs/src → module}/utils/getNativeLocales.d.ts +0 -0
- /package/dist/{typescript/commonjs/src → module}/utils/nativeStore.d.ts +0 -0
- /package/dist/{typescript/commonjs/src → module}/utils/utils.d.ts +0 -0
|
@@ -1,145 +1,126 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
example.displayName = new Intl.DisplayNames(locale, {
|
|
123
|
-
type: 'language'
|
|
124
|
-
}).of('en') || 'UNDEFINED';
|
|
125
|
-
} catch {
|
|
126
|
-
example.displayName = 'ERROR';
|
|
127
|
-
}
|
|
128
|
-
try {
|
|
129
|
-
example.locale = new Intl.Locale(locale).language;
|
|
130
|
-
} catch {
|
|
131
|
-
example.locale = 'ERROR';
|
|
132
|
-
}
|
|
133
|
-
const result = {
|
|
134
|
-
ok: problems.length === 0,
|
|
135
|
-
problems,
|
|
136
|
-
group,
|
|
137
|
-
decimal,
|
|
138
|
-
example
|
|
139
|
-
};
|
|
140
|
-
if (!result.ok) {
|
|
141
|
-
console.warn(`❌ Locale polyfill check failed for ${locale}:`, problems, example);
|
|
142
|
-
}
|
|
143
|
-
return result;
|
|
1
|
+
import { libraryDefaultLocale } from "generaltranslation/internal";
|
|
2
|
+
//#region src/tools/testLocalePolyfill.ts
|
|
3
|
+
function testLocalePolyfill(locale = libraryDefaultLocale) {
|
|
4
|
+
const problems = [];
|
|
5
|
+
if (!global.Intl) problems.push("Intl missing entirely");
|
|
6
|
+
[
|
|
7
|
+
"Locale",
|
|
8
|
+
"NumberFormat",
|
|
9
|
+
"DateTimeFormat",
|
|
10
|
+
"PluralRules",
|
|
11
|
+
"RelativeTimeFormat",
|
|
12
|
+
"ListFormat",
|
|
13
|
+
"DisplayNames"
|
|
14
|
+
].forEach((a) => {
|
|
15
|
+
if (!Intl[a]) problems.push(`Intl.${a} missing`);
|
|
16
|
+
});
|
|
17
|
+
const checks = [
|
|
18
|
+
["DateTimeFormat", Intl.DateTimeFormat],
|
|
19
|
+
["NumberFormat", Intl.NumberFormat],
|
|
20
|
+
["PluralRules", Intl.PluralRules],
|
|
21
|
+
["RelativeTimeFormat", Intl.RelativeTimeFormat],
|
|
22
|
+
["ListFormat", Intl.ListFormat],
|
|
23
|
+
["DisplayNames", Intl.DisplayNames]
|
|
24
|
+
];
|
|
25
|
+
for (const [name, api] of checks) try {
|
|
26
|
+
if (api.supportedLocalesOf([locale]).length === 0) problems.push(`${locale} not supported by ${name}`);
|
|
27
|
+
} catch (e) {
|
|
28
|
+
problems.push(`${name}.supportedLocalesOf threw: ${e instanceof Error ? e.message : String(e)}`);
|
|
29
|
+
}
|
|
30
|
+
let group, decimal;
|
|
31
|
+
try {
|
|
32
|
+
const parts = new Intl.NumberFormat(locale).formatToParts(1234.5);
|
|
33
|
+
group = parts.find((p) => p.type === "group")?.value;
|
|
34
|
+
decimal = parts.find((p) => p.type === "decimal")?.value;
|
|
35
|
+
if (!group || !decimal) problems.push("formatToParts missing group/decimal separators");
|
|
36
|
+
} catch (e) {
|
|
37
|
+
problems.push(`NumberFormat threw: ${e instanceof Error ? e.message : String(e)}`);
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
if (!new Intl.PluralRules(locale).select(5)) problems.push("PluralRules returned undefined");
|
|
41
|
+
} catch (e) {
|
|
42
|
+
problems.push(`PluralRules threw: ${e instanceof Error ? e.message : String(e)}`);
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
if (!new Intl.RelativeTimeFormat(locale).format(-1, "day")) problems.push("RelativeTimeFormat returned undefined");
|
|
46
|
+
} catch (e) {
|
|
47
|
+
problems.push(`RelativeTimeFormat threw: ${e instanceof Error ? e.message : String(e)}`);
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
if (!new Intl.ListFormat(locale).format([
|
|
51
|
+
"apple",
|
|
52
|
+
"orange",
|
|
53
|
+
"banana"
|
|
54
|
+
])) problems.push("ListFormat returned undefined");
|
|
55
|
+
} catch (e) {
|
|
56
|
+
problems.push(`ListFormat threw: ${e instanceof Error ? e.message : String(e)}`);
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
if (!new Intl.DisplayNames(locale, { type: "language" }).of("en")) problems.push("DisplayNames returned undefined");
|
|
60
|
+
} catch (e) {
|
|
61
|
+
problems.push(`DisplayNames threw: ${e instanceof Error ? e.message : String(e)}`);
|
|
62
|
+
}
|
|
63
|
+
try {
|
|
64
|
+
if (!new Intl.Locale(locale).language) problems.push("Locale missing language property");
|
|
65
|
+
} catch (e) {
|
|
66
|
+
problems.push(`Locale threw: ${e instanceof Error ? e.message : String(e)}`);
|
|
67
|
+
}
|
|
68
|
+
const example = {};
|
|
69
|
+
try {
|
|
70
|
+
example.number = new Intl.NumberFormat(locale).format(1234.5);
|
|
71
|
+
} catch {
|
|
72
|
+
example.number = "ERROR";
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
example.date = new Intl.DateTimeFormat(locale, { dateStyle: "long" }).format(/* @__PURE__ */ new Date("2020-01-02"));
|
|
76
|
+
} catch {
|
|
77
|
+
example.date = "ERROR";
|
|
78
|
+
}
|
|
79
|
+
try {
|
|
80
|
+
example.weekday = new Intl.DateTimeFormat(locale, { weekday: "long" }).format(/* @__PURE__ */ new Date("2020-01-02"));
|
|
81
|
+
} catch {
|
|
82
|
+
example.weekday = "ERROR";
|
|
83
|
+
}
|
|
84
|
+
try {
|
|
85
|
+
example.pluralRule = new Intl.PluralRules(locale).select(5);
|
|
86
|
+
} catch {
|
|
87
|
+
example.pluralRule = "ERROR";
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
example.relativeTime = new Intl.RelativeTimeFormat(locale).format(-1, "day");
|
|
91
|
+
} catch {
|
|
92
|
+
example.relativeTime = "ERROR";
|
|
93
|
+
}
|
|
94
|
+
try {
|
|
95
|
+
example.list = new Intl.ListFormat(locale).format([
|
|
96
|
+
"apple",
|
|
97
|
+
"orange",
|
|
98
|
+
"banana"
|
|
99
|
+
]);
|
|
100
|
+
} catch {
|
|
101
|
+
example.list = "ERROR";
|
|
102
|
+
}
|
|
103
|
+
try {
|
|
104
|
+
example.displayName = new Intl.DisplayNames(locale, { type: "language" }).of("en") || "UNDEFINED";
|
|
105
|
+
} catch {
|
|
106
|
+
example.displayName = "ERROR";
|
|
107
|
+
}
|
|
108
|
+
try {
|
|
109
|
+
example.locale = new Intl.Locale(locale).language;
|
|
110
|
+
} catch {
|
|
111
|
+
example.locale = "ERROR";
|
|
112
|
+
}
|
|
113
|
+
const result = {
|
|
114
|
+
ok: problems.length === 0,
|
|
115
|
+
problems,
|
|
116
|
+
group,
|
|
117
|
+
decimal,
|
|
118
|
+
example
|
|
119
|
+
};
|
|
120
|
+
if (!result.ok) console.warn(`❌ Locale polyfill check failed for ${locale}:`, problems, example);
|
|
121
|
+
return result;
|
|
144
122
|
}
|
|
123
|
+
//#endregion
|
|
124
|
+
export { testLocalePolyfill };
|
|
125
|
+
|
|
145
126
|
//# sourceMappingURL=testLocalePolyfill.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"testLocalePolyfill.js","names":[],"sources":["../../../src/tools/testLocalePolyfill.ts"],"sourcesContent":["import { libraryDefaultLocale } from 'generaltranslation/internal';\n\nexport function testLocalePolyfill(locale = libraryDefaultLocale) {\n const problems = [];\n\n // 1. basic presence\n if (!global.Intl) problems.push('Intl missing entirely');\n const apis = [\n 'Locale',\n 'NumberFormat',\n 'DateTimeFormat',\n 'PluralRules',\n 'RelativeTimeFormat',\n 'ListFormat',\n 'DisplayNames',\n ];\n apis.forEach((a) => {\n // @ts-ignore\n if (!Intl[a]) problems.push(`Intl.${a} missing`);\n });\n\n // 2. locale actually supported (no silent fallback)\n const checks: [\n string,\n { supportedLocalesOf(locales: string[]): string[] },\n ][] = [\n ['DateTimeFormat', Intl.DateTimeFormat],\n ['NumberFormat', Intl.NumberFormat],\n ['PluralRules', Intl.PluralRules],\n ['RelativeTimeFormat', Intl.RelativeTimeFormat],\n ['ListFormat', Intl.ListFormat],\n ['DisplayNames', Intl.DisplayNames],\n ];\n\n for (const [name, api] of checks) {\n try {\n const supported = api.supportedLocalesOf([locale]);\n if (supported.length === 0) {\n problems.push(`${locale} not supported by ${name}`);\n }\n } catch (e) {\n problems.push(\n `${name}.supportedLocalesOf threw: ${e instanceof Error ? e.message : String(e)}`\n );\n }\n }\n\n // 3. numeric separators sanity\n let group, decimal;\n try {\n const parts = new Intl.NumberFormat(locale).formatToParts(1234.5);\n group = parts.find((p) => p.type === 'group')?.value;\n decimal = parts.find((p) => p.type === 'decimal')?.value;\n if (!group || !decimal)\n problems.push('formatToParts missing group/decimal separators');\n } catch (e) {\n problems.push(\n `NumberFormat threw: ${e instanceof Error ? e.message : String(e)}`\n );\n }\n\n // 4. plural rules sanity\n try {\n const pr = new Intl.PluralRules(locale);\n const sample = pr.select(5);\n if (!sample) problems.push('PluralRules returned undefined');\n } catch (e) {\n problems.push(\n `PluralRules threw: ${e instanceof Error ? e.message : String(e)}`\n );\n }\n\n // 5. relative time format sanity\n try {\n const rtf = new Intl.RelativeTimeFormat(locale);\n const sample = rtf.format(-1, 'day');\n if (!sample) problems.push('RelativeTimeFormat returned undefined');\n } catch (e) {\n problems.push(\n `RelativeTimeFormat threw: ${e instanceof Error ? e.message : String(e)}`\n );\n }\n\n // 6. list format sanity\n try {\n const lf = new Intl.ListFormat(locale);\n const sample = lf.format(['apple', 'orange', 'banana']);\n if (!sample) problems.push('ListFormat returned undefined');\n } catch (e) {\n problems.push(\n `ListFormat threw: ${e instanceof Error ? e.message : String(e)}`\n );\n }\n\n // 7. display names sanity\n try {\n const dn = new Intl.DisplayNames(locale, { type: 'language' });\n const sample = dn.of('en');\n if (!sample) problems.push('DisplayNames returned undefined');\n } catch (e) {\n problems.push(\n `DisplayNames threw: ${e instanceof Error ? e.message : String(e)}`\n );\n }\n\n // 8. locale sanity\n try {\n const loc = new Intl.Locale(locale);\n if (!loc.language) problems.push('Locale missing language property');\n } catch (e) {\n problems.push(\n `Locale threw: ${e instanceof Error ? e.message : String(e)}`\n );\n }\n\n // 9. show example formatted values\n const example: Record<string, string> = {};\n\n try {\n example.number = new Intl.NumberFormat(locale).format(1234.5);\n } catch {\n example.number = 'ERROR';\n }\n\n try {\n example.date = new Intl.DateTimeFormat(locale, {\n dateStyle: 'long',\n }).format(new Date('2020-01-02'));\n } catch {\n example.date = 'ERROR';\n }\n\n try {\n example.weekday = new Intl.DateTimeFormat(locale, {\n weekday: 'long',\n }).format(new Date('2020-01-02'));\n } catch {\n example.weekday = 'ERROR';\n }\n\n try {\n example.pluralRule = new Intl.PluralRules(locale).select(5);\n } catch {\n example.pluralRule = 'ERROR';\n }\n\n try {\n example.relativeTime = new Intl.RelativeTimeFormat(locale).format(\n -1,\n 'day'\n );\n } catch {\n example.relativeTime = 'ERROR';\n }\n\n try {\n example.list = new Intl.ListFormat(locale).format([\n 'apple',\n 'orange',\n 'banana',\n ]);\n } catch {\n example.list = 'ERROR';\n }\n\n try {\n example.displayName =\n new Intl.DisplayNames(locale, { type: 'language' }).of('en') ||\n 'UNDEFINED';\n } catch {\n example.displayName = 'ERROR';\n }\n\n try {\n example.locale = new Intl.Locale(locale).language;\n } catch {\n example.locale = 'ERROR';\n }\n\n const result = {\n ok: problems.length === 0,\n problems,\n group,\n decimal,\n example,\n };\n\n if (!result.ok) {\n console.warn(\n `❌ Locale polyfill check failed for ${locale}:`,\n problems,\n example\n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MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,CAAC,EAAE;QACf,MAAM,EAAE,YAAY,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IACnC,cAAc,CAAC,EAAE,YAAY,CAAC;IAC9B,gBAAgB,CAAC,EAAE,YAAY,CAAC;IAChC,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getNativeLocales.d.ts","sourceRoot":"","sources":["../../../src/utils/getNativeLocales.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,EAAE,CAa3C"}
|
|
@@ -1,57 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import GtReactNative from "../NativeGtReactNative.js";
|
|
5
|
-
|
|
1
|
+
import NativeGtReactNative_default from "../NativeGtReactNative.js";
|
|
2
|
+
import { Platform } from "react-native";
|
|
3
|
+
//#region src/utils/getNativeLocales.ts
|
|
6
4
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// Try to get locales from native module
|
|
22
|
-
return GtReactNative.getNativeLocales() || [];
|
|
23
|
-
} catch {
|
|
24
|
-
// Return empty array on any error (native module not available, etc.)
|
|
25
|
-
return [];
|
|
26
|
-
}
|
|
5
|
+
* Get native device locales in preference order
|
|
6
|
+
* Returns an empty array if detection fails or is not supported
|
|
7
|
+
*
|
|
8
|
+
* iOS: Returns current locale first, followed by preferred languages
|
|
9
|
+
* Android: Returns user's preferred language list (LocaleList on API 24+, single locale on older versions)
|
|
10
|
+
* Web: Returns browser language preferences from navigator
|
|
11
|
+
*/
|
|
12
|
+
function getNativeLocales() {
|
|
13
|
+
try {
|
|
14
|
+
if (Platform.OS === "web") return getWebLocales();
|
|
15
|
+
return NativeGtReactNative_default.getNativeLocales() || [];
|
|
16
|
+
} catch {
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
27
19
|
}
|
|
28
|
-
|
|
29
20
|
/**
|
|
30
|
-
|
|
31
|
-
|
|
21
|
+
* Get browser locales for web platform
|
|
22
|
+
*/
|
|
32
23
|
function getWebLocales() {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
// IE fallback
|
|
47
|
-
const legacyNavigator = navigator;
|
|
48
|
-
if (legacyNavigator.userLanguage) {
|
|
49
|
-
locales.push(legacyNavigator.userLanguage);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return locales;
|
|
53
|
-
} catch {
|
|
54
|
-
return [];
|
|
55
|
-
}
|
|
24
|
+
try {
|
|
25
|
+
if (typeof navigator === "undefined") return [];
|
|
26
|
+
const locales = [];
|
|
27
|
+
if (navigator.languages && Array.isArray(navigator.languages)) locales.push(...navigator.languages);
|
|
28
|
+
else if (navigator.language) locales.push(navigator.language);
|
|
29
|
+
else {
|
|
30
|
+
const legacyNavigator = navigator;
|
|
31
|
+
if (legacyNavigator.userLanguage) locales.push(legacyNavigator.userLanguage);
|
|
32
|
+
}
|
|
33
|
+
return locales;
|
|
34
|
+
} catch {
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
56
37
|
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { getNativeLocales };
|
|
40
|
+
|
|
57
41
|
//# sourceMappingURL=getNativeLocales.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"getNativeLocales.js","names":["GtReactNative"],"sources":["../../../src/utils/getNativeLocales.ts"],"sourcesContent":["import { Platform } from 'react-native';\nimport GtReactNative from '../NativeGtReactNative';\n\n/**\n * Get native device locales in preference order\n * Returns an empty array if detection fails or is not supported\n *\n * iOS: Returns current locale first, followed by preferred languages\n * Android: Returns user's preferred language list (LocaleList on API 24+, single locale on older versions)\n * Web: Returns browser language preferences from navigator\n */\nexport function getNativeLocales(): string[] {\n try {\n // Web platform - use browser locale detection\n if (Platform.OS === 'web') {\n return getWebLocales();\n }\n\n // Try to get locales from native module\n return GtReactNative.getNativeLocales() || [];\n } catch {\n // Return empty array on any error (native module not available, etc.)\n return [];\n }\n}\n\n/**\n * Get browser locales for web platform\n */\nfunction getWebLocales(): string[] {\n try {\n if (typeof navigator === 'undefined') {\n return [];\n }\n\n const locales: string[] = [];\n\n // Use navigator.languages if available (most browsers)\n if (navigator.languages && Array.isArray(navigator.languages)) {\n locales.push(...navigator.languages);\n } else if (navigator.language) {\n // Fallback to single language\n locales.push(navigator.language);\n } else {\n // IE fallback\n const legacyNavigator = navigator as Navigator & {\n userLanguage?: string;\n };\n if (legacyNavigator.userLanguage) {\n locales.push(legacyNavigator.userLanguage);\n }\n }\n\n return locales;\n } catch {\n return [];\n }\n}\n"],"mappings":";;;;;;;;;;;AAWA,SAAgB,mBAA6B;AAC3C,KAAI;AAEF,MAAI,SAAS,OAAO,MAClB,QAAO,eAAe;AAIxB,SAAOA,4BAAc,kBAAkB,IAAI,EAAE;SACvC;AAEN,SAAO,EAAE;;;;;;AAOb,SAAS,gBAA0B;AACjC,KAAI;AACF,MAAI,OAAO,cAAc,YACvB,QAAO,EAAE;EAGX,MAAM,UAAoB,EAAE;AAG5B,MAAI,UAAU,aAAa,MAAM,QAAQ,UAAU,UAAU,CAC3D,SAAQ,KAAK,GAAG,UAAU,UAAU;WAC3B,UAAU,SAEnB,SAAQ,KAAK,UAAU,SAAS;OAC3B;GAEL,MAAM,kBAAkB;AAGxB,OAAI,gBAAgB,aAClB,SAAQ,KAAK,gBAAgB,aAAa;;AAI9C,SAAO;SACD;AACN,SAAO,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeStore.d.ts","sourceRoot":"","sources":["../../../src/utils/nativeStore.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAUzD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAW/D"}
|
|
@@ -1,45 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { Platform } from 'react-native';
|
|
4
|
-
import GtReactNative from "../NativeGtReactNative.js";
|
|
1
|
+
import NativeGtReactNative_default from "../NativeGtReactNative.js";
|
|
5
2
|
import { ssrUnsupportedWarning } from "../errors-dir/warnings.js";
|
|
6
|
-
|
|
3
|
+
import { Platform } from "react-native";
|
|
4
|
+
//#region src/utils/nativeStore.ts
|
|
7
5
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
* Native store interface, used to replace cookie behavior from gt-react
|
|
7
|
+
*/
|
|
11
8
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return GtReactNative.nativeStoreGet(key);
|
|
9
|
+
* Get a value from the native store
|
|
10
|
+
* @param key - The key to get the value for
|
|
11
|
+
* @returns The value for the key
|
|
12
|
+
*/
|
|
13
|
+
function nativeStoreGet(key) {
|
|
14
|
+
if (Platform.OS === "web") {
|
|
15
|
+
if (typeof localStorage === "undefined") {
|
|
16
|
+
console.warn(ssrUnsupportedWarning);
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return localStorage.getItem(key);
|
|
20
|
+
}
|
|
21
|
+
return NativeGtReactNative_default.nativeStoreGet(key);
|
|
26
22
|
}
|
|
27
|
-
|
|
28
23
|
/**
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
GtReactNative.nativeStoreSet(key, value);
|
|
24
|
+
* Set a value in the native store
|
|
25
|
+
* @param key - The key to set the value for
|
|
26
|
+
* @param value - The value to set
|
|
27
|
+
*/
|
|
28
|
+
function nativeStoreSet(key, value) {
|
|
29
|
+
if (Platform.OS === "web") {
|
|
30
|
+
if (typeof localStorage === "undefined") {
|
|
31
|
+
console.warn(ssrUnsupportedWarning);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
localStorage.setItem(key, value);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
NativeGtReactNative_default.nativeStoreSet(key, value);
|
|
44
38
|
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { nativeStoreGet, nativeStoreSet };
|
|
41
|
+
|
|
45
42
|
//# sourceMappingURL=nativeStore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"nativeStore.js","names":["GtReactNative"],"sources":["../../../src/utils/nativeStore.ts"],"sourcesContent":["import { Platform } from 'react-native';\nimport GtReactNative from '../NativeGtReactNative';\nimport { ssrUnsupportedWarning } from '../errors-dir/warnings';\n\n/**\n * Native store interface, used to replace cookie behavior from gt-react\n */\n\n/**\n * Get a value from the native store\n * @param key - The key to get the value for\n * @returns The value for the key\n */\nexport function nativeStoreGet(key: string): string | null {\n if (Platform.OS === 'web') {\n if (typeof localStorage === 'undefined') {\n // eslint-disable-next-line no-console\n console.warn(ssrUnsupportedWarning);\n return null;\n }\n return localStorage.getItem(key);\n }\n return GtReactNative.nativeStoreGet(key);\n}\n\n/**\n * Set a value in the native store\n * @param key - The key to set the value for\n * @param value - The value to set\n */\nexport function nativeStoreSet(key: string, value: string): void {\n if (Platform.OS === 'web') {\n if (typeof localStorage === 'undefined') {\n // eslint-disable-next-line no-console\n console.warn(ssrUnsupportedWarning);\n return;\n }\n localStorage.setItem(key, value);\n return;\n }\n GtReactNative.nativeStoreSet(key, value);\n}\n"],"mappings":";;;;;;;;;;;;AAaA,SAAgB,eAAe,KAA4B;AACzD,KAAI,SAAS,OAAO,OAAO;AACzB,MAAI,OAAO,iBAAiB,aAAa;AAEvC,WAAQ,KAAK,sBAAsB;AACnC,UAAO;;AAET,SAAO,aAAa,QAAQ,IAAI;;AAElC,QAAOA,4BAAc,eAAe,IAAI;;;;;;;AAQ1C,SAAgB,eAAe,KAAa,OAAqB;AAC/D,KAAI,SAAS,OAAO,OAAO;AACzB,MAAI,OAAO,iBAAiB,aAAa;AAEvC,WAAQ,KAAK,sBAAsB;AACnC;;AAEF,eAAa,QAAQ,KAAK,MAAM;AAChC;;AAEF,6BAAc,eAAe,KAAK,MAAM"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,sCAAsC,CAAC;AAE9C,wBAAgB,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,iBAAiB,CAM5E"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return {
|
|
9
|
-
projectId: projectId || '',
|
|
10
|
-
devApiKey: devApiKey
|
|
11
|
-
};
|
|
1
|
+
//#region src/utils/utils.ts
|
|
2
|
+
function readAuthFromEnv(params) {
|
|
3
|
+
const { projectId, devApiKey } = params;
|
|
4
|
+
return {
|
|
5
|
+
projectId: projectId || "",
|
|
6
|
+
devApiKey
|
|
7
|
+
};
|
|
12
8
|
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { readAuthFromEnv };
|
|
11
|
+
|
|
13
12
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../../../src/utils/utils.ts"],"sourcesContent":["import type {\n AuthFromEnvParams,\n AuthFromEnvReturn,\n} from '@generaltranslation/react-core/types';\n\nexport function readAuthFromEnv(params: AuthFromEnvParams): AuthFromEnvReturn {\n const { projectId, devApiKey } = params;\n return {\n projectId: projectId || '',\n devApiKey: devApiKey,\n };\n}\n"],"mappings":";AAKA,SAAgB,gBAAgB,QAA8C;CAC5E,MAAM,EAAE,WAAW,cAAc;AACjC,QAAO;EACL,WAAW,aAAa;EACb;EACZ"}
|