@umituz/react-native-settings 4.23.134 → 4.23.136

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-settings",
3
- "version": "4.23.134",
3
+ "version": "4.23.136",
4
4
  "description": "Complete settings hub for React Native apps - consolidated package with settings, localization, about, legal, appearance, feedback, FAQs, rating, and gamification",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -52,7 +52,7 @@ async function translateMissing(targetDir, srcDir) {
52
52
  const target = parseTypeScriptFile(targetPath);
53
53
 
54
54
  const stats = { count: 0, checked: 0, translatedKeys: [] };
55
- await translateObject(enUS, target, targetLang, '', stats, { forceRetranslate: true });
55
+ await translateObject(enUS, target, targetLang, '', stats);
56
56
 
57
57
  // Clear progress line
58
58
  process.stdout.write('\r' + ' '.repeat(80) + '\r');
@@ -80,7 +80,8 @@ async function translateMissing(targetDir, srcDir) {
80
80
  console.log('\n✅ All translations completed!');
81
81
  }
82
82
 
83
- if (import.meta.url === `file://${process.argv[1]}`) {
83
+ const isMainModule = import.meta.url.endsWith('translate-missing.js');
84
+ if (isMainModule) {
84
85
  const args = process.argv.slice(2).filter(arg => !arg.startsWith('--'));
85
86
  const targetDir = args[0] || 'src/domains/localization/infrastructure/locales';
86
87
  const srcDir = args[1];
@@ -32,7 +32,7 @@ async function translateText(text, targetLang) {
32
32
  }
33
33
  }
34
34
 
35
- function needsTranslation(value, enValue, forceRetranslate = false) {
35
+ function needsTranslation(value, enValue) {
36
36
  if (typeof enValue !== 'string' || !enValue.trim()) return false;
37
37
  if (shouldSkipWord(enValue)) return false;
38
38
 
@@ -49,9 +49,6 @@ function needsTranslation(value, enValue, forceRetranslate = false) {
49
49
  return !isSingleWord;
50
50
  }
51
51
 
52
- // Force re-translation if flag is set
53
- if (forceRetranslate) return true;
54
-
55
52
  // Detect outdated template patterns (e.g., {{appName}}, {{variable}})
56
53
  if (value && typeof value === 'string') {
57
54
  const hasTemplatePattern = value.includes('{{') && value.includes('}}');
@@ -63,11 +60,10 @@ function needsTranslation(value, enValue, forceRetranslate = false) {
63
60
  return false;
64
61
  }
65
62
 
66
- export async function translateObject(enObj, targetObj, targetLang, path = '', stats = { count: 0, checked: 0, translatedKeys: [] }, options = {}) {
63
+ export async function translateObject(enObj, targetObj, targetLang, path = '', stats = { count: 0, checked: 0, translatedKeys: [] }) {
67
64
  const keys = Object.keys(enObj);
68
65
 
69
66
  if (!stats.translatedKeys) stats.translatedKeys = [];
70
- const { forceRetranslate = false } = options;
71
67
 
72
68
  for (const key of keys) {
73
69
  const enValue = enObj[key];
@@ -76,10 +72,10 @@ export async function translateObject(enObj, targetObj, targetLang, path = '', s
76
72
 
77
73
  if (typeof enValue === 'object' && enValue !== null) {
78
74
  if (!targetObj[key] || typeof targetObj[key] !== 'object') targetObj[key] = {};
79
- await translateObject(enValue, targetObj[key], targetLang, currentPath, stats, options);
75
+ await translateObject(enValue, targetObj[key], targetLang, currentPath, stats);
80
76
  } else if (typeof enValue === 'string') {
81
77
  stats.checked++;
82
- if (needsTranslation(targetValue, enValue, forceRetranslate)) {
78
+ if (needsTranslation(targetValue, enValue)) {
83
79
  // Show progress for translations
84
80
  process.stdout.write(` \r Progress: ${stats.checked} keys checked, ${stats.count} translated...`);
85
81