@umituz/react-native-localization 1.16.0 → 1.16.2
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,24 +1,73 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* en-US Translation Module
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
* Direct loading for maximum compatibility across platforms
|
|
5
|
+
* - Explicit imports for reliable bundling
|
|
6
|
+
* - Flattened with dot notation
|
|
7
|
+
* - Production-ready and tested
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import alerts from './alerts.json';
|
|
11
|
+
import auth from './auth.json';
|
|
12
|
+
import branding from './branding.json';
|
|
13
|
+
import clipboard from './clipboard.json';
|
|
14
|
+
import datetime from './datetime.json';
|
|
15
|
+
import device from './device.json';
|
|
16
|
+
import editor from './editor.json';
|
|
17
|
+
import errors from './errors.json';
|
|
18
|
+
import general from './general.json';
|
|
19
|
+
import goals from './goals.json';
|
|
20
|
+
import haptics from './haptics.json';
|
|
21
|
+
import home from './home.json';
|
|
22
|
+
import navigation from './navigation.json';
|
|
23
|
+
import onboarding from './onboarding.json';
|
|
24
|
+
import projects from './projects.json';
|
|
25
|
+
import settings from './settings.json';
|
|
26
|
+
import sharing from './sharing.json';
|
|
27
|
+
import templates from './templates.json';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Flatten nested objects with dot notation
|
|
13
31
|
*/
|
|
32
|
+
const flattenObject = (
|
|
33
|
+
obj: Record<string, any>,
|
|
34
|
+
prefix = '',
|
|
35
|
+
): Record<string, string> => {
|
|
36
|
+
const flattened: Record<string, string> = {};
|
|
37
|
+
|
|
38
|
+
Object.keys(obj).forEach((key) => {
|
|
39
|
+
const newKey = prefix ? `${prefix}.${key}` : key;
|
|
14
40
|
|
|
15
|
-
|
|
41
|
+
if (obj[key] && typeof obj[key] === 'object' && !Array.isArray(obj[key])) {
|
|
42
|
+
Object.assign(flattened, flattenObject(obj[key], newKey));
|
|
43
|
+
} else {
|
|
44
|
+
flattened[newKey] = obj[key];
|
|
45
|
+
}
|
|
46
|
+
});
|
|
16
47
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const translationContext = (require as any).context('./', false, /\.json$/);
|
|
48
|
+
return flattened;
|
|
49
|
+
};
|
|
20
50
|
|
|
21
|
-
//
|
|
22
|
-
const translations =
|
|
51
|
+
// Create flattened translations object
|
|
52
|
+
const translations = {
|
|
53
|
+
...flattenObject(alerts, 'alerts'),
|
|
54
|
+
...flattenObject(auth, 'auth'),
|
|
55
|
+
...flattenObject(branding, 'branding'),
|
|
56
|
+
...flattenObject(clipboard, 'clipboard'),
|
|
57
|
+
...flattenObject(datetime, 'datetime'),
|
|
58
|
+
...flattenObject(device, 'device'),
|
|
59
|
+
...flattenObject(editor, 'editor'),
|
|
60
|
+
...flattenObject(errors, 'errors'),
|
|
61
|
+
...flattenObject(general, 'general'),
|
|
62
|
+
...flattenObject(goals, 'goals'),
|
|
63
|
+
...flattenObject(haptics, 'haptics'),
|
|
64
|
+
...flattenObject(home, 'home'),
|
|
65
|
+
...flattenObject(navigation, 'navigation'),
|
|
66
|
+
...flattenObject(onboarding, 'onboarding'),
|
|
67
|
+
...flattenObject(projects, 'projects'),
|
|
68
|
+
...flattenObject(settings, 'settings'),
|
|
69
|
+
...flattenObject(sharing, 'sharing'),
|
|
70
|
+
...flattenObject(templates, 'templates'),
|
|
71
|
+
};
|
|
23
72
|
|
|
24
73
|
export default translations;
|