@umituz/react-native-localization 3.5.29 → 3.5.31
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
|
@@ -47,15 +47,13 @@ const LANGUAGE_MAP = {
|
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
const SKIP_WORDS = new Set([
|
|
50
|
-
'OK',
|
|
51
|
-
'Email',
|
|
52
50
|
'Google',
|
|
53
51
|
'Apple',
|
|
54
52
|
'Facebook',
|
|
55
|
-
'
|
|
56
|
-
'
|
|
57
|
-
'
|
|
58
|
-
'
|
|
53
|
+
'Instagram',
|
|
54
|
+
'Twitter',
|
|
55
|
+
'YouTube',
|
|
56
|
+
'WhatsApp',
|
|
59
57
|
]);
|
|
60
58
|
|
|
61
59
|
const LANGUAGE_NAMES = {
|
|
@@ -54,7 +54,13 @@ function needsTranslation(value, enValue) {
|
|
|
54
54
|
|
|
55
55
|
if (!value || typeof value !== 'string') return true;
|
|
56
56
|
|
|
57
|
-
if (value === enValue)
|
|
57
|
+
if (value === enValue) {
|
|
58
|
+
const isSingleWord = !enValue.includes(' ') && enValue.length < 20;
|
|
59
|
+
if (isSingleWord) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
58
64
|
|
|
59
65
|
return false;
|
|
60
66
|
}
|
|
@@ -76,9 +82,17 @@ async function translateObject(enObj, targetObj, targetLang, path = '', stats =
|
|
|
76
82
|
const isNewKey = targetObj[key][i] === enValue[i];
|
|
77
83
|
const prefix = isNewKey ? '🆕 NEW' : '🔄';
|
|
78
84
|
console.log(` ${prefix} ${currentPath}[${i}]: "${preview}"`);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
85
|
+
|
|
86
|
+
const translated = await translateText(enValue[i], targetLang);
|
|
87
|
+
|
|
88
|
+
if (translated !== enValue[i]) {
|
|
89
|
+
targetObj[key][i] = translated;
|
|
90
|
+
stats.count++;
|
|
91
|
+
if (isNewKey) stats.newKeys.push(`${currentPath}[${i}]`);
|
|
92
|
+
} else {
|
|
93
|
+
console.log(` ⏭️ Skipped (universal word): ${currentPath}[${i}]`);
|
|
94
|
+
}
|
|
95
|
+
|
|
82
96
|
await delay(200);
|
|
83
97
|
}
|
|
84
98
|
}
|
|
@@ -94,9 +108,17 @@ async function translateObject(enObj, targetObj, targetLang, path = '', stats =
|
|
|
94
108
|
const isNewKey = targetValue === enValue;
|
|
95
109
|
const prefix = isNewKey ? '🆕 NEW' : '🔄';
|
|
96
110
|
console.log(` ${prefix} ${currentPath}: "${preview}"`);
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
111
|
+
|
|
112
|
+
const translated = await translateText(enValue, targetLang);
|
|
113
|
+
|
|
114
|
+
if (translated !== enValue) {
|
|
115
|
+
targetObj[key] = translated;
|
|
116
|
+
stats.count++;
|
|
117
|
+
if (isNewKey) stats.newKeys.push(currentPath);
|
|
118
|
+
} else {
|
|
119
|
+
console.log(` ⏭️ Skipped (universal word): ${currentPath}`);
|
|
120
|
+
}
|
|
121
|
+
|
|
100
122
|
await delay(200);
|
|
101
123
|
}
|
|
102
124
|
}
|