@umituz/react-native-localization 3.7.4 → 3.7.6
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 +43 -19
- package/src/infrastructure/hooks/useLanguageSelection.ts +12 -4
- package/src/infrastructure/storage/LanguageInitializer.ts +2 -1
- package/src/presentation/components/LanguageItem.tsx +3 -1
- package/src/presentation/components/LanguageSection.tsx +8 -2
- package/src/presentation/screens/LanguageSelectionScreen.tsx +9 -3
- package/src/presentation/screens/__tests__/LanguageSelectionScreen.test.tsx +0 -1
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-localization",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.6",
|
|
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",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"typecheck": "
|
|
9
|
-
"lint": "
|
|
8
|
+
"typecheck": "tsc --noEmit",
|
|
9
|
+
"lint": "eslint src --ext .ts,.tsx --max-warnings 0",
|
|
10
10
|
"version:patch": "npm version patch -m 'chore: release v%s'",
|
|
11
11
|
"version:minor": "npm version minor -m 'chore: release v%s'",
|
|
12
12
|
"version:major": "npm version major -m 'chore: release v%s'"
|
|
@@ -35,27 +35,51 @@
|
|
|
35
35
|
"zustand": ">=4.0.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
+
"@expo/vector-icons": "^15.0.3",
|
|
38
39
|
"@react-native-async-storage/async-storage": "~2.1.2",
|
|
39
|
-
"@react-
|
|
40
|
-
"@react-
|
|
41
|
-
"@react-navigation/
|
|
40
|
+
"@react-native-community/datetimepicker": "^8.5.1",
|
|
41
|
+
"@react-native-community/slider": "^5.1.1",
|
|
42
|
+
"@react-navigation/bottom-tabs": "^7.9.0",
|
|
43
|
+
"@react-navigation/native": "^7.1.26",
|
|
44
|
+
"@react-navigation/stack": "^7.6.13",
|
|
45
|
+
"@tanstack/query-async-storage-persister": "^5.66.7",
|
|
46
|
+
"@tanstack/react-query": "^5.66.7",
|
|
47
|
+
"@tanstack/react-query-persist-client": "^5.66.7",
|
|
42
48
|
"@types/react": "~19.1.10",
|
|
43
|
-
"@
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"expo-
|
|
50
|
-
"expo-
|
|
51
|
-
"
|
|
49
|
+
"@typescript-eslint/eslint-plugin": "^8.52.0",
|
|
50
|
+
"@typescript-eslint/parser": "^8.52.0",
|
|
51
|
+
"@umituz/react-native-design-system": "*",
|
|
52
|
+
"eslint": "^9.39.2",
|
|
53
|
+
"eslint-plugin-react": "^7.37.5",
|
|
54
|
+
"eslint-plugin-react-native": "^5.0.0",
|
|
55
|
+
"expo-apple-authentication": "^8.0.8",
|
|
56
|
+
"expo-application": "^7.0.8",
|
|
57
|
+
"expo-clipboard": "^8.0.8",
|
|
58
|
+
"expo-crypto": "^15.0.8",
|
|
59
|
+
"expo-device": "^8.0.10",
|
|
60
|
+
"expo-file-system": "^19.0.21",
|
|
61
|
+
"expo-font": "^14.0.10",
|
|
62
|
+
"expo-haptics": "^15.0.8",
|
|
63
|
+
"expo-image": "^3.0.11",
|
|
64
|
+
"expo-image-manipulator": "^14.0.8",
|
|
65
|
+
"expo-image-picker": "^17.0.10",
|
|
66
|
+
"expo-localization": "^17.0.8",
|
|
67
|
+
"expo-media-library": "^18.2.1",
|
|
68
|
+
"expo-modules-core": "^3.0.29",
|
|
69
|
+
"expo-network": "^8.0.8",
|
|
70
|
+
"expo-secure-store": "^15.0.8",
|
|
71
|
+
"expo-sharing": "^14.0.8",
|
|
72
|
+
"expo-video": "^3.0.15",
|
|
73
|
+
"i18next": "^25.7.3",
|
|
52
74
|
"react": "19.1.0",
|
|
53
|
-
"react-i18next": "^
|
|
75
|
+
"react-i18next": "^16.5.1",
|
|
54
76
|
"react-native": "0.81.5",
|
|
55
|
-
"react-native-gesture-handler": "
|
|
56
|
-
"react-native-safe-area-context": "
|
|
77
|
+
"react-native-gesture-handler": "^2.30.0",
|
|
78
|
+
"react-native-safe-area-context": "^5.6.2",
|
|
79
|
+
"react-native-svg": "^15.15.1",
|
|
80
|
+
"rn-emoji-keyboard": "^1.7.0",
|
|
57
81
|
"typescript": "~5.9.2",
|
|
58
|
-
"zustand": "^5.0.
|
|
82
|
+
"zustand": "^5.0.3"
|
|
59
83
|
},
|
|
60
84
|
"publishConfig": {
|
|
61
85
|
"access": "public"
|
|
@@ -17,13 +17,21 @@ export const useLanguageSelection = () => {
|
|
|
17
17
|
}, [searchQuery]);
|
|
18
18
|
|
|
19
19
|
const handleLanguageSelect = async (code: string, onComplete?: () => void) => {
|
|
20
|
-
|
|
20
|
+
if (__DEV__) {
|
|
21
|
+
console.log('[useLanguageSelection] handleLanguageSelect called:', { code, currentLanguage });
|
|
22
|
+
}
|
|
21
23
|
setSelectedCode(code);
|
|
22
|
-
|
|
24
|
+
if (__DEV__) {
|
|
25
|
+
console.log('[useLanguageSelection] Calling setLanguage...');
|
|
26
|
+
}
|
|
23
27
|
await setLanguage(code);
|
|
24
|
-
|
|
28
|
+
if (__DEV__) {
|
|
29
|
+
console.log('[useLanguageSelection] Language changed to:', code);
|
|
30
|
+
}
|
|
25
31
|
onComplete?.();
|
|
26
|
-
|
|
32
|
+
if (__DEV__) {
|
|
33
|
+
console.log('[useLanguageSelection] onComplete callback executed');
|
|
34
|
+
}
|
|
27
35
|
};
|
|
28
36
|
|
|
29
37
|
return {
|
|
@@ -30,7 +30,8 @@ export class LanguageInitializer {
|
|
|
30
30
|
const finalLanguage = await this.validateAndSetupLanguage(languageCode);
|
|
31
31
|
|
|
32
32
|
return finalLanguage;
|
|
33
|
-
} catch
|
|
33
|
+
} catch {
|
|
34
|
+
console.warn("[LanguageInitializer] Failed to restore language, falling back to device locale");
|
|
34
35
|
return await this.setupFallbackLanguage();
|
|
35
36
|
}
|
|
36
37
|
}
|
|
@@ -71,7 +71,9 @@ export const LanguageItem: React.FC<LanguageItemProps> = ({
|
|
|
71
71
|
customStyles?.languageItem,
|
|
72
72
|
]}
|
|
73
73
|
onPress={() => {
|
|
74
|
-
|
|
74
|
+
if (__DEV__) {
|
|
75
|
+
console.log('[LanguageItem] TouchableOpacity pressed:', item.code, item.nativeName);
|
|
76
|
+
}
|
|
75
77
|
onSelect(item.code);
|
|
76
78
|
}}
|
|
77
79
|
activeOpacity={0.7}
|
|
@@ -5,13 +5,14 @@ import {
|
|
|
5
5
|
useAppDesignTokens,
|
|
6
6
|
AtomicText,
|
|
7
7
|
ListItem,
|
|
8
|
-
|
|
8
|
+
useAppNavigation,
|
|
9
9
|
} from '@umituz/react-native-design-system';
|
|
10
10
|
import { useLocalization } from '../../infrastructure/hooks/useLocalization';
|
|
11
11
|
import { getLanguageByCode } from '../../infrastructure/config/languages';
|
|
12
12
|
|
|
13
13
|
export interface LanguageSectionConfig {
|
|
14
14
|
route?: string;
|
|
15
|
+
onPress?: () => void;
|
|
15
16
|
title?: string;
|
|
16
17
|
description?: string;
|
|
17
18
|
defaultLanguageDisplay?: string;
|
|
@@ -30,6 +31,7 @@ export const LanguageSection: React.FC<LanguageSectionProps> = ({
|
|
|
30
31
|
}) => {
|
|
31
32
|
const tokens = useAppDesignTokens();
|
|
32
33
|
const { t, currentLanguage } = useLocalization();
|
|
34
|
+
const navigation = useAppNavigation();
|
|
33
35
|
|
|
34
36
|
const route = config?.route || 'LanguageSelection';
|
|
35
37
|
const title = config?.title || t('settings.languageSelection.title') || 'Language';
|
|
@@ -42,7 +44,11 @@ export const LanguageSection: React.FC<LanguageSectionProps> = ({
|
|
|
42
44
|
: defaultLanguageDisplay;
|
|
43
45
|
|
|
44
46
|
const handlePress = () => {
|
|
45
|
-
|
|
47
|
+
if (config?.onPress) {
|
|
48
|
+
config.onPress();
|
|
49
|
+
} else {
|
|
50
|
+
navigation.navigate(route as never);
|
|
51
|
+
}
|
|
46
52
|
};
|
|
47
53
|
|
|
48
54
|
return (
|
|
@@ -39,12 +39,18 @@ export const LanguageSelectionScreen: React.FC<LanguageSelectionScreenProps> = (
|
|
|
39
39
|
} = useLanguageSelection();
|
|
40
40
|
|
|
41
41
|
const onSelect = async (code: string) => {
|
|
42
|
-
|
|
42
|
+
if (__DEV__) {
|
|
43
|
+
console.log('[LanguageSelectionScreen] onSelect called with code:', code);
|
|
44
|
+
}
|
|
43
45
|
await handleLanguageSelect(code, () => {
|
|
44
|
-
|
|
46
|
+
if (__DEV__) {
|
|
47
|
+
console.log('[LanguageSelectionScreen] Navigating back using context navigation');
|
|
48
|
+
}
|
|
45
49
|
navigation.goBack();
|
|
46
50
|
});
|
|
47
|
-
|
|
51
|
+
if (__DEV__) {
|
|
52
|
+
console.log('[LanguageSelectionScreen] Language change completed');
|
|
53
|
+
}
|
|
48
54
|
};
|
|
49
55
|
|
|
50
56
|
const renderItem = ({ item }: { item: Language }) => {
|