@umituz/react-native-localization 1.7.3 → 1.7.5
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)`);
|
|
@@ -199,7 +199,7 @@ const resources = buildResources();
|
|
|
199
199
|
|
|
200
200
|
// Debug: Log loaded resources in development (only once to prevent spam)
|
|
201
201
|
// Use global flag to prevent multiple logs when module is imported multiple times
|
|
202
|
-
if (typeof
|
|
202
|
+
if (typeof globalThis !== 'undefined' && !(globalThis as any).__i18n_resources_logged) {
|
|
203
203
|
/* eslint-disable-next-line no-console */
|
|
204
204
|
if (typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
205
205
|
console.log('🌍 i18n Resources loaded:', {
|
|
@@ -210,7 +210,7 @@ if (typeof global !== 'undefined' && !(global as any).__i18n_resources_logged) {
|
|
|
210
210
|
hasMilestones: !!resources['en-US']?.translation?.navigation?.milestones,
|
|
211
211
|
hasStatistics: !!resources['en-US']?.translation?.navigation?.statistics,
|
|
212
212
|
});
|
|
213
|
-
(
|
|
213
|
+
(globalThis as any).__i18n_resources_logged = true;
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "AI Video Generator",
|
|
3
|
+
"subtitle": "Create stunning videos with AI - from text to video, images to video, and templates",
|
|
4
|
+
"testAlerts": {
|
|
5
|
+
"success": "Test Success Alert",
|
|
6
|
+
"error": "Test Error Alert",
|
|
7
|
+
"warning": "Test Warning Alert",
|
|
8
|
+
"info": "Test Info Alert"
|
|
9
|
+
},
|
|
10
|
+
"alertMessages": {
|
|
11
|
+
"successTitle": "Test Success",
|
|
12
|
+
"successMessage": "This is a success alert!",
|
|
13
|
+
"errorTitle": "Test Error",
|
|
14
|
+
"errorMessage": "This is an error alert!",
|
|
15
|
+
"warningTitle": "Test Warning",
|
|
16
|
+
"warningMessage": "This is a warning alert!",
|
|
17
|
+
"infoTitle": "Test Info",
|
|
18
|
+
"infoMessage": "This is an info alert!"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -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-16T13:59:24.900Z
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
// Metro bundler require.context - auto-discover all .json files
|
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
{
|
|
2
|
+
"skip": "Skip",
|
|
3
|
+
"back": "Back",
|
|
4
|
+
"next": "Next",
|
|
5
|
+
"getStarted": "Get Started",
|
|
2
6
|
"slides": {
|
|
3
7
|
"slide1": {
|
|
4
|
-
"title": "
|
|
5
|
-
"description": "
|
|
8
|
+
"title": "AI Video Creator",
|
|
9
|
+
"description": "Create stunning videos with AI - from text to video, images to video, and templates"
|
|
6
10
|
},
|
|
7
11
|
"slide2": {
|
|
8
|
-
"title": "
|
|
9
|
-
"description": "
|
|
12
|
+
"title": "Multiple Creation Methods",
|
|
13
|
+
"description": "Generate videos from text descriptions, upload images, or use ready templates",
|
|
14
|
+
"features": ["Text to Video", "Image to Video", "AI Script Generator"]
|
|
10
15
|
},
|
|
11
16
|
"slide3": {
|
|
12
|
-
"title": "
|
|
13
|
-
"description": "
|
|
17
|
+
"title": "Professional Editing",
|
|
18
|
+
"description": "Edit videos with advanced tools - add text, animations, music and effects",
|
|
19
|
+
"features": ["Text Overlays", "Animations", "Audio Tracks"]
|
|
20
|
+
},
|
|
21
|
+
"slide4": {
|
|
22
|
+
"title": "Start Creating",
|
|
23
|
+
"description": "Begin your video creation journey with AI-powered tools"
|
|
14
24
|
}
|
|
15
25
|
}
|
|
16
26
|
}
|