@umituz/react-native-localization 3.5.39 → 3.5.41
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 +1 -1
- package/src/infrastructure/components/LanguageSwitcher.tsx +1 -2
- package/src/infrastructure/components/useLanguageSwitcher.ts +1 -6
- package/src/infrastructure/components/useLocalizationProvider.ts +0 -18
- package/src/infrastructure/config/languagesData.ts +0 -6
- package/src/infrastructure/hooks/useTranslation.ts +0 -5
package/package.json
CHANGED
|
@@ -23,7 +23,6 @@ export interface LanguageSwitcherProps {
|
|
|
23
23
|
const DEFAULT_CONFIG = {
|
|
24
24
|
defaultIconSize: 20,
|
|
25
25
|
hitSlop: { top: 10, bottom: 10, left: 10, right: 10 } as const,
|
|
26
|
-
defaultColor: '#000000',
|
|
27
26
|
activeOpacity: 0.7,
|
|
28
27
|
};
|
|
29
28
|
|
|
@@ -41,7 +40,7 @@ export const LanguageSwitcher: React.FC<LanguageSwitcherProps> = ({
|
|
|
41
40
|
}) => {
|
|
42
41
|
const { currentLang, handlePress } = useLanguageSwitcher({ onPress, disabled });
|
|
43
42
|
|
|
44
|
-
const iconColor =
|
|
43
|
+
const iconColor = color;
|
|
45
44
|
|
|
46
45
|
const accessibilityProps = useMemo(() => ({
|
|
47
46
|
accessibilityRole: 'button' as const,
|
|
@@ -24,13 +24,8 @@ export const useLanguageSwitcher = ({ onPress, disabled }: UseLanguageSwitcherPr
|
|
|
24
24
|
if (disabled) {
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
if (__DEV__) {
|
|
29
|
-
console.log('[LanguageSwitcher] Pressed, current language:', currentLanguage);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
27
|
onPress?.();
|
|
33
|
-
}, [disabled, onPress
|
|
28
|
+
}, [disabled, onPress]);
|
|
34
29
|
|
|
35
30
|
return {
|
|
36
31
|
currentLang,
|
|
@@ -43,21 +43,10 @@ export const useLocalizationProvider = ({
|
|
|
43
43
|
|
|
44
44
|
const initializeLocalization = async () => {
|
|
45
45
|
try {
|
|
46
|
-
if (__DEV__) {
|
|
47
|
-
console.log('[LocalizationProvider] Initializing with language:', defaultLanguage);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
46
|
await I18nInitializer.initialize(memoizedTranslations.current, defaultLanguage);
|
|
51
47
|
await initialize();
|
|
52
|
-
|
|
53
|
-
if (__DEV__) {
|
|
54
|
-
console.log('[LocalizationProvider] Initialization complete');
|
|
55
|
-
}
|
|
56
48
|
} catch (error) {
|
|
57
49
|
const initializationError = error instanceof Error ? error : new Error('Initialization failed');
|
|
58
|
-
if (__DEV__) {
|
|
59
|
-
console.error('[LocalizationProvider] Initialization failed:', initializationError);
|
|
60
|
-
}
|
|
61
50
|
onError?.(initializationError);
|
|
62
51
|
} finally {
|
|
63
52
|
isInitializingRef.current = false;
|
|
@@ -72,10 +61,6 @@ export const useLocalizationProvider = ({
|
|
|
72
61
|
if (previousLanguageRef.current !== currentLanguage) {
|
|
73
62
|
previousLanguageRef.current = currentLanguage;
|
|
74
63
|
onLanguageChange?.(currentLanguage);
|
|
75
|
-
|
|
76
|
-
if (__DEV__) {
|
|
77
|
-
console.log('[LocalizationProvider] Language changed to:', currentLanguage);
|
|
78
|
-
}
|
|
79
64
|
}
|
|
80
65
|
}, [currentLanguage, onLanguageChange]);
|
|
81
66
|
|
|
@@ -85,9 +70,6 @@ export const useLocalizationProvider = ({
|
|
|
85
70
|
await setLanguage(languageCode);
|
|
86
71
|
} catch (error) {
|
|
87
72
|
const changeError = error instanceof Error ? error : new Error('Language change failed');
|
|
88
|
-
if (__DEV__) {
|
|
89
|
-
console.error('[LocalizationProvider] Language change failed:', changeError);
|
|
90
|
-
}
|
|
91
73
|
onError?.(changeError);
|
|
92
74
|
throw changeError;
|
|
93
75
|
}
|
|
@@ -64,9 +64,6 @@ class LanguageRegistry {
|
|
|
64
64
|
*/
|
|
65
65
|
registerLanguages(languages: Language[]): void {
|
|
66
66
|
this.languages = [...this.languages, ...languages];
|
|
67
|
-
if (__DEV__) {
|
|
68
|
-
console.log(`[Localization] Registered ${languages.length} languages`);
|
|
69
|
-
}
|
|
70
67
|
}
|
|
71
68
|
|
|
72
69
|
/**
|
|
@@ -81,9 +78,6 @@ class LanguageRegistry {
|
|
|
81
78
|
*/
|
|
82
79
|
clearLanguages(): void {
|
|
83
80
|
this.languages = [...DEFAULT_LANGUAGES];
|
|
84
|
-
if (__DEV__) {
|
|
85
|
-
console.log('[Localization] Cleared language registry');
|
|
86
|
-
}
|
|
87
81
|
}
|
|
88
82
|
|
|
89
83
|
/**
|
|
@@ -87,11 +87,6 @@ export const useTranslationFunction = () => {
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
// Development mode logging - only log missing translations
|
|
91
|
-
if (__DEV__ && !translationFound) {
|
|
92
|
-
console.warn(`[i18n] ⚠️ Missing - Key: "${usedKey}" → Fallback: "${finalResult}"`);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
90
|
return finalResult;
|
|
96
91
|
}, [i18nextT, ready]);
|
|
97
92
|
|