@umituz/react-native-localization 3.5.13 → 3.5.14
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
|
@@ -50,10 +50,8 @@ export class I18nInitializer {
|
|
|
50
50
|
missingKeyHandler: false,
|
|
51
51
|
debug: false,
|
|
52
52
|
});
|
|
53
|
-
} catch
|
|
54
|
-
|
|
55
|
-
console.error('[Localization] init error:', error);
|
|
56
|
-
}
|
|
53
|
+
} catch {
|
|
54
|
+
// Silent error handling
|
|
57
55
|
}
|
|
58
56
|
}
|
|
59
57
|
|
|
@@ -71,13 +69,4 @@ export class I18nInitializer {
|
|
|
71
69
|
}
|
|
72
70
|
}
|
|
73
71
|
|
|
74
|
-
/**
|
|
75
|
-
* @deprecated Use initialize instead
|
|
76
|
-
*/
|
|
77
|
-
static registerAppTranslations(
|
|
78
|
-
appTranslations: Record<string, any>,
|
|
79
|
-
languageCode: string = DEFAULT_LANGUAGE
|
|
80
|
-
): void {
|
|
81
|
-
this.initialize(appTranslations, languageCode);
|
|
82
|
-
}
|
|
83
72
|
}
|
|
@@ -22,10 +22,6 @@ export class LanguageSwitcher {
|
|
|
22
22
|
}> {
|
|
23
23
|
const language = languageRegistry.getLanguageByCode(languageCode);
|
|
24
24
|
|
|
25
|
-
if (!language && __DEV__) {
|
|
26
|
-
console.warn(`[LanguageSwitcher] Language ${languageCode} not found in registry, proceeding anyway.`);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
25
|
await i18n.changeLanguage(languageCode);
|
|
30
26
|
await storageRepository.setString(LANGUAGE_STORAGE_KEY, languageCode);
|
|
31
27
|
|
|
@@ -9,9 +9,7 @@ import { LanguageInitializer } from './LanguageInitializer';
|
|
|
9
9
|
import { LanguageSwitcher } from './LanguageSwitcher';
|
|
10
10
|
import { languageRegistry } from '../config/languagesData';
|
|
11
11
|
|
|
12
|
-
interface LocalizationStore extends LocalizationState, LocalizationActions, LocalizationGetters {
|
|
13
|
-
// Additional properties can be added here if needed
|
|
14
|
-
}
|
|
12
|
+
interface LocalizationStore extends LocalizationState, LocalizationActions, LocalizationGetters { }
|
|
15
13
|
|
|
16
14
|
/**
|
|
17
15
|
* Create localization store with proper dependency injection
|
|
@@ -29,9 +27,6 @@ export const createLocalizationStore = () => {
|
|
|
29
27
|
initialize: async () => {
|
|
30
28
|
const { isInitialized: alreadyInitialized } = get();
|
|
31
29
|
if (alreadyInitialized) {
|
|
32
|
-
if (__DEV__) {
|
|
33
|
-
console.log('[Localization] Already initialized');
|
|
34
|
-
}
|
|
35
30
|
return;
|
|
36
31
|
}
|
|
37
32
|
|
|
@@ -43,44 +38,22 @@ export const createLocalizationStore = () => {
|
|
|
43
38
|
isRTL: result.isRTL,
|
|
44
39
|
isInitialized: true,
|
|
45
40
|
});
|
|
46
|
-
|
|
47
|
-
if (__DEV__) {
|
|
48
|
-
console.log(`[Localization] Initialized with language: ${result.languageCode}`);
|
|
49
|
-
}
|
|
50
|
-
} catch (error) {
|
|
51
|
-
// Set fallback state even on error
|
|
41
|
+
} catch {
|
|
52
42
|
set({
|
|
53
43
|
currentLanguage: 'en-US',
|
|
54
44
|
isRTL: false,
|
|
55
45
|
isInitialized: true,
|
|
56
46
|
});
|
|
57
|
-
|
|
58
|
-
if (__DEV__) {
|
|
59
|
-
console.error('[Localization] Initialization failed, using fallback:', error);
|
|
60
|
-
}
|
|
61
47
|
}
|
|
62
48
|
},
|
|
63
49
|
|
|
64
|
-
|
|
65
|
-
|
|
66
50
|
setLanguage: async (languageCode: string) => {
|
|
67
|
-
|
|
68
|
-
const result = await LanguageSwitcher.switchLanguage(languageCode);
|
|
51
|
+
const result = await LanguageSwitcher.switchLanguage(languageCode);
|
|
69
52
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (__DEV__) {
|
|
76
|
-
console.log(`[Localization] Language changed to: ${result.languageCode}`);
|
|
77
|
-
}
|
|
78
|
-
} catch (error) {
|
|
79
|
-
if (__DEV__) {
|
|
80
|
-
console.error('[Localization] Language change failed:', error);
|
|
81
|
-
}
|
|
82
|
-
throw error;
|
|
83
|
-
}
|
|
53
|
+
set({
|
|
54
|
+
currentLanguage: result.languageCode,
|
|
55
|
+
isRTL: result.isRTL,
|
|
56
|
+
});
|
|
84
57
|
},
|
|
85
58
|
|
|
86
59
|
reset: () => {
|
|
@@ -89,10 +62,6 @@ export const createLocalizationStore = () => {
|
|
|
89
62
|
isRTL: false,
|
|
90
63
|
isInitialized: false,
|
|
91
64
|
});
|
|
92
|
-
|
|
93
|
-
if (__DEV__) {
|
|
94
|
-
console.log('[Localization] Store reset');
|
|
95
|
-
}
|
|
96
65
|
},
|
|
97
66
|
|
|
98
67
|
// Getters
|