@umituz/react-native-localization 1.15.0 → 1.16.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-localization",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.0",
|
|
4
4
|
"description": "English-only localization system for React Native apps with i18n support",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -36,16 +36,17 @@
|
|
|
36
36
|
"url": "https://github.com/umituz/react-native-localization"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
+
"expo-localization": "~15.0.0",
|
|
39
40
|
"i18next": "^23.0.0",
|
|
40
41
|
"react-i18next": "^14.0.0",
|
|
41
|
-
"zustand": "^5.0.2"
|
|
42
|
-
"expo-localization": "~15.0.0"
|
|
42
|
+
"zustand": "^5.0.2"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"react": ">=18.2.0",
|
|
46
|
-
"react-native": ">=0.74.0",
|
|
47
45
|
"@react-navigation/native": ">=6.0.0",
|
|
48
|
-
"@umituz/react-native-
|
|
46
|
+
"@umituz/react-native-filesystem": "latest",
|
|
47
|
+
"@umituz/react-native-storage": "latest",
|
|
48
|
+
"react": ">=18.2.0",
|
|
49
|
+
"react-native": ">=0.74.0"
|
|
49
50
|
},
|
|
50
51
|
"peerDependenciesMeta": {
|
|
51
52
|
"@react-navigation/native": {
|
|
@@ -53,16 +54,17 @@
|
|
|
53
54
|
}
|
|
54
55
|
},
|
|
55
56
|
"devDependencies": {
|
|
56
|
-
"typescript": "^5.3.3",
|
|
57
57
|
"@types/react": "^18.2.45",
|
|
58
58
|
"@types/react-native": "^0.73.0",
|
|
59
|
-
"react": "
|
|
60
|
-
"react-native": "
|
|
61
|
-
"
|
|
59
|
+
"@umituz/react-native-filesystem": "^1.4.0",
|
|
60
|
+
"@umituz/react-native-storage": "^1.1.1",
|
|
61
|
+
"expo-localization": "~15.0.0",
|
|
62
62
|
"i18next": "^23.0.0",
|
|
63
|
+
"react": ">=18.2.0",
|
|
63
64
|
"react-i18next": "^14.0.0",
|
|
64
|
-
"
|
|
65
|
-
"
|
|
65
|
+
"react-native": ">=0.74.0",
|
|
66
|
+
"typescript": "^5.3.3",
|
|
67
|
+
"zustand": "^5.0.2"
|
|
66
68
|
},
|
|
67
69
|
"publishConfig": {
|
|
68
70
|
"access": "public"
|
|
@@ -1,45 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Auto-loader for en-US translation modules
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
7
|
-
* - Build-time resolution (fast, no runtime overhead)
|
|
8
|
-
* - Works for all languages automatically
|
|
9
|
-
*
|
|
10
|
-
* OFFLINE-ONLY TRANSLATIONS (All domains work without backend):
|
|
11
|
-
* - Automatically imports ALL .json files in this directory
|
|
12
|
-
* - Alphabetically sorted for consistency
|
|
4
|
+
* Uses @umituz/react-native-filesystem for professional module loading
|
|
5
|
+
* - Auto-discovers all .json files in this directory
|
|
6
|
+
* - Zero manual updates needed when adding new translation files
|
|
13
7
|
* - Type-safe with TypeScript
|
|
14
8
|
*
|
|
15
9
|
* USAGE:
|
|
16
10
|
* 1. Create new translation file: my_domain.json
|
|
17
11
|
* 2. File is auto-discovered and loaded
|
|
18
12
|
* 3. Access via t('my_domain.key')
|
|
19
|
-
*
|
|
20
|
-
* This file is automatically generated by setup-languages.js or createLocaleLoaders.js
|
|
21
|
-
* but can be manually edited if needed.
|
|
22
|
-
*
|
|
23
|
-
* Generated: 2025-11-16T18:53:58.972Z
|
|
24
13
|
*/
|
|
25
14
|
|
|
15
|
+
import { loadJsonModules } from '@umituz/react-native-filesystem';
|
|
16
|
+
|
|
26
17
|
// Metro bundler require.context - auto-discover all .json files
|
|
27
18
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
28
19
|
const translationContext = (require as any).context('./', false, /\.json$/);
|
|
29
20
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
* Extracts module name from path (e.g., './auth.json' -> 'auth')
|
|
33
|
-
*/
|
|
34
|
-
const translations: Record<string, any> = {};
|
|
35
|
-
|
|
36
|
-
translationContext.keys().forEach((key: string) => {
|
|
37
|
-
// Extract module name from path: './auth.json' -> 'auth'
|
|
38
|
-
const match = key.match(/\.\/([^/]+)\.json$/);
|
|
39
|
-
if (match) {
|
|
40
|
-
const moduleName = match[1];
|
|
41
|
-
translations[moduleName] = translationContext(key);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
21
|
+
// Load all JSON modules automatically using filesystem utility
|
|
22
|
+
const translations = loadJsonModules(translationContext);
|
|
44
23
|
|
|
45
24
|
export default translations;
|