@umituz/react-native-localization 3.5.28 → 3.5.30

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.28",
3
+ "version": "3.5.30",
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",
@@ -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
- 'Premium',
56
- 'Pro',
57
- 'Plus',
58
- 'BPM',
53
+ 'Instagram',
54
+ 'Twitter',
55
+ 'YouTube',
56
+ 'WhatsApp',
59
57
  ]);
60
58
 
61
59
  const LANGUAGE_NAMES = {
@@ -64,7 +64,6 @@ async function translateObject(enObj, targetObj, targetLang, path = '', stats =
64
64
  const currentPath = path ? `${path}.${key}` : key;
65
65
  const enValue = enObj[key];
66
66
  const targetValue = targetObj[key];
67
- const isNewKey = !Object.prototype.hasOwnProperty.call(targetObj, key);
68
67
 
69
68
  if (Array.isArray(enValue)) {
70
69
  if (!Array.isArray(targetValue)) {
@@ -74,11 +73,20 @@ async function translateObject(enObj, targetObj, targetLang, path = '', stats =
74
73
  if (typeof enValue[i] === 'string') {
75
74
  if (needsTranslation(targetObj[key][i], enValue[i])) {
76
75
  const preview = enValue[i].length > 40 ? enValue[i].substring(0, 40) + '...' : enValue[i];
76
+ const isNewKey = targetObj[key][i] === enValue[i];
77
77
  const prefix = isNewKey ? '🆕 NEW' : '🔄';
78
78
  console.log(` ${prefix} ${currentPath}[${i}]: "${preview}"`);
79
- targetObj[key][i] = await translateText(enValue[i], targetLang);
80
- stats.count++;
81
- if (isNewKey) stats.newKeys.push(`${currentPath}[${i}]`);
79
+
80
+ const translated = await translateText(enValue[i], targetLang);
81
+
82
+ if (translated !== enValue[i]) {
83
+ targetObj[key][i] = translated;
84
+ stats.count++;
85
+ if (isNewKey) stats.newKeys.push(`${currentPath}[${i}]`);
86
+ } else {
87
+ console.log(` ⏭️ Skipped (universal word): ${currentPath}[${i}]`);
88
+ }
89
+
82
90
  await delay(200);
83
91
  }
84
92
  }
@@ -91,11 +99,20 @@ async function translateObject(enObj, targetObj, targetLang, path = '', stats =
91
99
  } else if (typeof enValue === 'string') {
92
100
  if (needsTranslation(targetValue, enValue)) {
93
101
  const preview = enValue.length > 40 ? enValue.substring(0, 40) + '...' : enValue;
102
+ const isNewKey = targetValue === enValue;
94
103
  const prefix = isNewKey ? '🆕 NEW' : '🔄';
95
104
  console.log(` ${prefix} ${currentPath}: "${preview}"`);
96
- targetObj[key] = await translateText(enValue, targetLang);
97
- stats.count++;
98
- if (isNewKey) stats.newKeys.push(currentPath);
105
+
106
+ const translated = await translateText(enValue, targetLang);
107
+
108
+ if (translated !== enValue) {
109
+ targetObj[key] = translated;
110
+ stats.count++;
111
+ if (isNewKey) stats.newKeys.push(currentPath);
112
+ } else {
113
+ console.log(` ⏭️ Skipped (universal word): ${currentPath}`);
114
+ }
115
+
99
116
  await delay(200);
100
117
  }
101
118
  }