@umituz/react-native-localization 1.7.3 → 1.7.4
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
|
@@ -67,15 +67,62 @@ const LANGUAGE_MAP = {
|
|
|
67
67
|
'zh-TW': 'zh-TW', // Chinese Traditional
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
//
|
|
71
|
-
//
|
|
70
|
+
// Skip brand names and common words that are the same in most languages
|
|
71
|
+
// These words don't need translation and should be preserved as-is
|
|
72
72
|
const SKIP_WORDS = new Set([
|
|
73
|
+
// Brand names
|
|
73
74
|
'Google',
|
|
74
75
|
'Apple',
|
|
75
76
|
'Facebook',
|
|
76
77
|
'Instagram',
|
|
77
78
|
'Twitter',
|
|
78
79
|
'WhatsApp',
|
|
80
|
+
|
|
81
|
+
// Common UI words that are often the same
|
|
82
|
+
'OK',
|
|
83
|
+
'Yes',
|
|
84
|
+
'No',
|
|
85
|
+
'Cancel',
|
|
86
|
+
'Save',
|
|
87
|
+
'Delete',
|
|
88
|
+
'Edit',
|
|
89
|
+
'Back',
|
|
90
|
+
'Next',
|
|
91
|
+
'Previous',
|
|
92
|
+
'Close',
|
|
93
|
+
'Open',
|
|
94
|
+
'Menu',
|
|
95
|
+
'Settings',
|
|
96
|
+
'Help',
|
|
97
|
+
'Info',
|
|
98
|
+
'Error',
|
|
99
|
+
'Warning',
|
|
100
|
+
'Success',
|
|
101
|
+
'Loading',
|
|
102
|
+
'Search',
|
|
103
|
+
'Filter',
|
|
104
|
+
'Sort',
|
|
105
|
+
'View',
|
|
106
|
+
'Show',
|
|
107
|
+
'Hide',
|
|
108
|
+
|
|
109
|
+
// Technical terms
|
|
110
|
+
'API',
|
|
111
|
+
'URL',
|
|
112
|
+
'HTTP',
|
|
113
|
+
'HTTPS',
|
|
114
|
+
'JSON',
|
|
115
|
+
'XML',
|
|
116
|
+
'PDF',
|
|
117
|
+
'CSV',
|
|
118
|
+
'ID',
|
|
119
|
+
|
|
120
|
+
// Common abbreviations
|
|
121
|
+
'etc.',
|
|
122
|
+
'e.g.',
|
|
123
|
+
'i.e.',
|
|
124
|
+
'vs.',
|
|
125
|
+
'etc',
|
|
79
126
|
]);
|
|
80
127
|
|
|
81
128
|
/**
|
|
@@ -169,10 +216,10 @@ async function translateText(text, targetLang, retryCount = 0) {
|
|
|
169
216
|
translateText(text, targetLang, retryCount + 1).then(resolve);
|
|
170
217
|
}, RETRY_DELAY * (retryCount + 1));
|
|
171
218
|
} else {
|
|
172
|
-
|
|
219
|
+
console.warn(
|
|
173
220
|
`⚠️ Translation failed for "${text}" to ${targetLang}: ${error.message}`
|
|
174
|
-
|
|
175
|
-
|
|
221
|
+
);
|
|
222
|
+
resolve(text); // Fallback to original
|
|
176
223
|
}
|
|
177
224
|
}
|
|
178
225
|
});
|
|
@@ -188,10 +235,10 @@ async function translateText(text, targetLang, retryCount = 0) {
|
|
|
188
235
|
translateText(text, targetLang, retryCount + 1).then(resolve);
|
|
189
236
|
}, RETRY_DELAY * (retryCount + 1));
|
|
190
237
|
} else {
|
|
191
|
-
|
|
238
|
+
console.warn(
|
|
192
239
|
`⚠️ Network error translating "${text}" to ${targetLang}: ${err.message}`
|
|
193
|
-
|
|
194
|
-
|
|
240
|
+
);
|
|
241
|
+
resolve(text); // Fallback to original
|
|
195
242
|
}
|
|
196
243
|
});
|
|
197
244
|
});
|
|
@@ -284,7 +331,7 @@ function needsTranslation(key, value, enValue) {
|
|
|
284
331
|
}
|
|
285
332
|
|
|
286
333
|
// Skip if already translated (value is different from English)
|
|
287
|
-
// This protects manual translations!
|
|
334
|
+
// This protects manual translations and prevents re-translation of auto-translated strings!
|
|
288
335
|
if (value !== enValue) {
|
|
289
336
|
if (options.verbose) {
|
|
290
337
|
console.log(` ⏭️ Skipping "${key}": already translated (manual or previous auto)`);
|
|
@@ -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-14T22:27:21.619Z
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
// Metro bundler require.context - auto-discover all .json files
|