@umituz/react-native-localization 3.5.18 → 3.5.20

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.18",
3
+ "version": "3.5.20",
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",
@@ -61,25 +61,25 @@
61
61
  "@expo/vector-icons": "^15.0.3",
62
62
  "@react-native-async-storage/async-storage": "^2.2.0",
63
63
  "@react-native-community/datetimepicker": "^8.5.1",
64
- "@react-navigation/native": "^6.1.17",
64
+ "@react-navigation/native": "^6.1.18",
65
65
  "@testing-library/jest-native": "^5.4.3",
66
66
  "@testing-library/react": "^16.3.0",
67
67
  "@testing-library/react-hooks": "^8.0.1",
68
68
  "@testing-library/react-native": "^13.3.3",
69
69
  "@types/react": "^18.2.45",
70
70
  "@types/react-native": "^0.73.0",
71
- "@umituz/react-native-design-system": "latest",
71
+ "@umituz/react-native-design-system": "^2.0.4",
72
72
  "@umituz/react-native-filesystem": "^1.4.0",
73
73
  "@umituz/react-native-icons": "^1.1.2",
74
- "@umituz/react-native-storage": "^2.4.0",
74
+ "@umituz/react-native-storage": "^2.4.1",
75
75
  "expo-localization": "~15.0.0",
76
- "i18next": "^23.0.0",
76
+ "i18next": "^23.16.8",
77
77
  "jest": "^30.2.0",
78
78
  "jest-environment-jsdom": "^30.2.0",
79
79
  "jest-transform-stub": "^2.0.0",
80
80
  "react": ">=18.2.0",
81
- "react-i18next": "^14.0.0",
82
- "react-native": ">=0.74.0",
81
+ "react-i18next": "^14.1.3",
82
+ "react-native": "^0.83.1",
83
83
  "react-native-gesture-handler": "^2.29.1",
84
84
  "react-native-safe-area-context": "^5.6.2",
85
85
  "react-test-renderer": "^19.2.0",
@@ -28,10 +28,11 @@ export const getDeviceLocale = (): string => {
28
28
 
29
29
  // Extract language code
30
30
  const languageCode = deviceLocale.split('-')[0];
31
+ const mappedByCode = languageCode ? LOCALE_MAPPING[languageCode] : undefined;
31
32
 
32
33
  // Check language code
33
- if (LOCALE_MAPPING[languageCode]) {
34
- return LOCALE_MAPPING[languageCode];
34
+ if (mappedByCode) {
35
+ return mappedByCode;
35
36
  }
36
37
 
37
38
  // Check if directly supported
@@ -17,7 +17,12 @@ export const isLanguageSupported = (code: string): boolean => {
17
17
  };
18
18
 
19
19
  export const getDefaultLanguage = (): Language => {
20
- return languageRegistry.getLanguages()[0];
20
+ const langs = languageRegistry.getLanguages();
21
+ const firstLang = langs[0];
22
+ if (firstLang) return firstLang;
23
+
24
+ // Final fallback to system defaults if registry is empty
25
+ return languageRegistry.getDefaultLanguage();
21
26
  };
22
27
 
23
28
  export const searchLanguages = (query: string): Language[] => {
@@ -118,7 +118,12 @@ class LanguageRegistry {
118
118
  */
119
119
  getDefaultLanguage(): Language {
120
120
  const en = this.languages.find(l => l.code === 'en-US');
121
- return en || this.languages[0] || DEFAULT_LANGUAGES[0];
121
+ if (en) return en;
122
+ const first = this.languages[0];
123
+ if (first) return first;
124
+ const systemDefault = DEFAULT_LANGUAGES[0];
125
+ if (systemDefault) return systemDefault;
126
+ throw new Error('No languages registered in registry or defaults');
122
127
  }
123
128
  }
124
129
 
@@ -36,7 +36,7 @@ export const LanguageSection: React.FC<LanguageSectionProps> = ({
36
36
  const route = config?.route || 'LanguageSelection';
37
37
  const title = config?.title || t('settings.languageSelection.title') || 'Language';
38
38
  const displaySectionTitle = sectionTitle || title;
39
- const description = config?.description || '';
39
+ const _description = config?.description || '';
40
40
 
41
41
  const currentLang = getLanguageByCode(currentLanguage);
42
42
  const defaultLanguageDisplay = config?.defaultLanguageDisplay || 'English';