@umituz/react-native-localization 1.7.1 → 1.7.3
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/package.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* This file is automatically generated by setup-languages.js or createLocaleLoaders.js
|
|
21
21
|
* but can be manually edited if needed.
|
|
22
22
|
*
|
|
23
|
-
* Generated: 2025-11-
|
|
23
|
+
* Generated: 2025-11-13T02:42:52.919Z
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
// Metro bundler require.context - auto-discover all .json files
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
"welcome": {
|
|
3
|
-
"title": "Welcome!",
|
|
4
|
-
"subtitle": "Get started",
|
|
5
|
-
"getStarted": "Get Started",
|
|
6
|
-
"skip": "Skip"
|
|
7
|
-
},
|
|
8
2
|
"slides": {
|
|
9
3
|
"slide1": {
|
|
10
4
|
"title": "Welcome",
|
|
@@ -18,41 +12,5 @@
|
|
|
18
12
|
"title": "Ready",
|
|
19
13
|
"description": "Let's begin"
|
|
20
14
|
}
|
|
21
|
-
},
|
|
22
|
-
"permissions": {
|
|
23
|
-
"title": "Permissions",
|
|
24
|
-
"subtitle": "We need some permissions to provide the best experience",
|
|
25
|
-
"location": {
|
|
26
|
-
"title": "Location",
|
|
27
|
-
"description": "Enable location services",
|
|
28
|
-
"enable": "Enable Location"
|
|
29
|
-
},
|
|
30
|
-
"camera": {
|
|
31
|
-
"title": "Camera",
|
|
32
|
-
"description": "Enable camera access",
|
|
33
|
-
"enable": "Enable Camera"
|
|
34
|
-
},
|
|
35
|
-
"photos": {
|
|
36
|
-
"title": "Photos",
|
|
37
|
-
"description": "Enable photo library access",
|
|
38
|
-
"enable": "Enable Photos"
|
|
39
|
-
},
|
|
40
|
-
"later": "I'll do this later",
|
|
41
|
-
"continue": "Continue"
|
|
42
|
-
},
|
|
43
|
-
"personalization": {
|
|
44
|
-
"title": "Personalize Your Experience",
|
|
45
|
-
"subtitle": "Set your preferences",
|
|
46
|
-
"preferences": {
|
|
47
|
-
"title": "Set your preferences",
|
|
48
|
-
"theme": "Choose Theme",
|
|
49
|
-
"language": "Choose Language"
|
|
50
|
-
},
|
|
51
|
-
"continue": "Continue"
|
|
52
|
-
},
|
|
53
|
-
"complete": {
|
|
54
|
-
"title": "You're All Set!",
|
|
55
|
-
"subtitle": "Let's get started!",
|
|
56
|
-
"startButton": "Start Using App"
|
|
57
15
|
}
|
|
58
16
|
}
|
|
@@ -140,16 +140,21 @@ export const useLocalization = () => {
|
|
|
140
140
|
|
|
141
141
|
// Use translation function from react-i18next if available and valid
|
|
142
142
|
// Otherwise fallback to direct i18n.t
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
// Type assertion needed because react-i18next's TFunction can return string | object
|
|
144
|
+
const t = (translationResult?.t && typeof translationResult.t === 'function' && i18n.isInitialized)
|
|
145
|
+
? ((key: string, options?: any): string => {
|
|
146
|
+
const result = translationResult.t(key, options);
|
|
147
|
+
return typeof result === 'string' ? result : String(result);
|
|
148
|
+
})
|
|
149
|
+
: ((key: string, options?: any): string => {
|
|
146
150
|
// Fallback to direct i18n.t if react-i18next is not ready
|
|
147
151
|
if (i18n.isInitialized && typeof i18n.t === 'function') {
|
|
148
|
-
|
|
152
|
+
const result = i18n.t(key, options);
|
|
153
|
+
return typeof result === 'string' ? result : String(result);
|
|
149
154
|
}
|
|
150
155
|
// Final fallback: return key if i18n is not ready
|
|
151
156
|
return key;
|
|
152
|
-
});
|
|
157
|
+
}) as (key: string, options?: any) => string;
|
|
153
158
|
|
|
154
159
|
return {
|
|
155
160
|
t, // Translation function from react-i18next or i18n fallback
|