@umituz/react-native-localization 3.5.33 → 3.5.36
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": "3.5.
|
|
3
|
+
"version": "3.5.36",
|
|
4
4
|
"description": "Generic localization system for React Native apps with i18n support",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -50,4 +50,4 @@
|
|
|
50
50
|
"README.md",
|
|
51
51
|
"LICENSE"
|
|
52
52
|
]
|
|
53
|
-
}
|
|
53
|
+
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { View,
|
|
2
|
+
import { View, StyleSheet, type ViewStyle } from 'react-native';
|
|
3
3
|
// @ts-ignore - Optional peer dependency
|
|
4
4
|
import { useNavigation } from '@react-navigation/native';
|
|
5
5
|
// @ts-ignore - Optional peer dependency
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
useAppDesignTokens,
|
|
8
|
+
AtomicText,
|
|
9
|
+
ListItem
|
|
10
|
+
} from '@umituz/react-native-design-system';
|
|
7
11
|
import { useLocalization } from '../../infrastructure/hooks/useLocalization';
|
|
8
12
|
import { getLanguageByCode } from '../../infrastructure/config/languages';
|
|
9
13
|
|
|
@@ -12,7 +16,6 @@ export interface LanguageSectionConfig {
|
|
|
12
16
|
title?: string;
|
|
13
17
|
description?: string;
|
|
14
18
|
defaultLanguageDisplay?: string;
|
|
15
|
-
// actions?
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
export interface LanguageSectionProps {
|
|
@@ -28,7 +31,6 @@ export const LanguageSection: React.FC<LanguageSectionProps> = ({
|
|
|
28
31
|
}) => {
|
|
29
32
|
const navigation = useNavigation();
|
|
30
33
|
const tokens = useAppDesignTokens();
|
|
31
|
-
const colors = tokens.colors;
|
|
32
34
|
const { t, currentLanguage } = useLocalization();
|
|
33
35
|
|
|
34
36
|
const route = config?.route || 'LanguageSelection';
|
|
@@ -46,36 +48,19 @@ export const LanguageSection: React.FC<LanguageSectionProps> = ({
|
|
|
46
48
|
};
|
|
47
49
|
|
|
48
50
|
return (
|
|
49
|
-
<View style={[styles.sectionContainer, { backgroundColor: colors.surface }, containerStyle]}>
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
51
|
+
<View style={[styles.sectionContainer, { backgroundColor: tokens.colors.surface }, containerStyle]}>
|
|
52
|
+
<View style={styles.headerContainer}>
|
|
53
|
+
<AtomicText type="titleMedium" color="primary">
|
|
54
|
+
{displaySectionTitle}
|
|
55
|
+
</AtomicText>
|
|
56
|
+
</View>
|
|
57
|
+
<ListItem
|
|
58
|
+
title={title}
|
|
59
|
+
subtitle={languageDisplay}
|
|
60
|
+
leftIcon="globe"
|
|
61
|
+
rightIcon="chevron-forward"
|
|
59
62
|
onPress={handlePress}
|
|
60
|
-
|
|
61
|
-
<View style={styles.content}>
|
|
62
|
-
<View
|
|
63
|
-
style={[
|
|
64
|
-
styles.iconContainer,
|
|
65
|
-
{ backgroundColor: `${colors.primary}15` },
|
|
66
|
-
]}
|
|
67
|
-
>
|
|
68
|
-
<AtomicIcon name="globe-outline" customSize={24} customColor={colors.primary} />
|
|
69
|
-
</View>
|
|
70
|
-
<View style={styles.textContainer}>
|
|
71
|
-
<Text style={[styles.title, { color: colors.textPrimary }]}>{title}</Text>
|
|
72
|
-
<Text style={[styles.description, { color: colors.textSecondary }]}>
|
|
73
|
-
{languageDisplay}
|
|
74
|
-
</Text>
|
|
75
|
-
</View>
|
|
76
|
-
<AtomicIcon name="chevron-forward-outline" customSize={20} customColor={colors.textSecondary} />
|
|
77
|
-
</View>
|
|
78
|
-
</Pressable>
|
|
63
|
+
/>
|
|
79
64
|
</View>
|
|
80
65
|
);
|
|
81
66
|
};
|
|
@@ -86,43 +71,9 @@ const styles = StyleSheet.create({
|
|
|
86
71
|
borderRadius: 12,
|
|
87
72
|
overflow: 'hidden',
|
|
88
73
|
},
|
|
89
|
-
|
|
90
|
-
fontSize: 18,
|
|
91
|
-
fontWeight: '600',
|
|
74
|
+
headerContainer: {
|
|
92
75
|
paddingHorizontal: 16,
|
|
93
76
|
paddingTop: 16,
|
|
94
77
|
paddingBottom: 8,
|
|
95
78
|
},
|
|
96
|
-
itemContainer: {
|
|
97
|
-
flexDirection: 'row',
|
|
98
|
-
alignItems: 'center',
|
|
99
|
-
paddingHorizontal: 16,
|
|
100
|
-
paddingVertical: 16,
|
|
101
|
-
minHeight: 72,
|
|
102
|
-
},
|
|
103
|
-
content: {
|
|
104
|
-
flex: 1,
|
|
105
|
-
flexDirection: 'row',
|
|
106
|
-
alignItems: 'center',
|
|
107
|
-
},
|
|
108
|
-
iconContainer: {
|
|
109
|
-
width: 48,
|
|
110
|
-
height: 48,
|
|
111
|
-
borderRadius: 12,
|
|
112
|
-
justifyContent: 'center',
|
|
113
|
-
alignItems: 'center',
|
|
114
|
-
marginRight: 16,
|
|
115
|
-
},
|
|
116
|
-
textContainer: {
|
|
117
|
-
flex: 1,
|
|
118
|
-
marginRight: 8,
|
|
119
|
-
},
|
|
120
|
-
title: {
|
|
121
|
-
fontSize: 16,
|
|
122
|
-
fontWeight: '500',
|
|
123
|
-
marginBottom: 4,
|
|
124
|
-
},
|
|
125
|
-
description: {
|
|
126
|
-
fontSize: 14,
|
|
127
|
-
},
|
|
128
79
|
});
|
|
@@ -103,10 +103,10 @@ async function translateObject(enObj, targetObj, targetLang, path = '', stats =
|
|
|
103
103
|
} else if (typeof enValue === 'string') {
|
|
104
104
|
if (needsTranslation(targetValue, enValue)) {
|
|
105
105
|
const translated = await translateText(enValue, targetLang);
|
|
106
|
+
const isNewKey = targetValue === undefined;
|
|
106
107
|
|
|
107
|
-
if (translated !== enValue) {
|
|
108
|
+
if (translated !== enValue || isNewKey) {
|
|
108
109
|
const preview = enValue.length > 40 ? enValue.substring(0, 40) + '...' : enValue;
|
|
109
|
-
const isNewKey = targetValue === enValue;
|
|
110
110
|
const prefix = isNewKey ? '🆕 NEW' : '🔄';
|
|
111
111
|
console.log(` ${prefix} ${currentPath}: "${preview}"`);
|
|
112
112
|
|