@umituz/react-native-localization 3.5.19 → 3.5.21

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.19",
3
+ "version": "3.5.21",
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",
@@ -2,7 +2,7 @@
2
2
  import { useNavigation } from '@react-navigation/native';
3
3
  import { useLocalization } from '../hooks/useLocalization';
4
4
  import { languageRegistry } from '../config/languagesData';
5
- import type { Language } from '../storage/types/LocalizationState';
5
+
6
6
 
7
7
  export const useLanguageNavigation = (navigationScreen: string) => {
8
8
  const navigation = useNavigation();
@@ -20,7 +20,9 @@ export const getDefaultLanguage = (): Language => {
20
20
  const langs = languageRegistry.getLanguages();
21
21
  const firstLang = langs[0];
22
22
  if (firstLang) return firstLang;
23
- throw new Error('No languages registered');
23
+
24
+ // Final fallback to system defaults if registry is empty
25
+ return languageRegistry.getDefaultLanguage();
24
26
  };
25
27
 
26
28
  export const searchLanguages = (query: string): Language[] => {
@@ -9,7 +9,7 @@
9
9
 
10
10
  import { storageRepository } from '@umituz/react-native-storage';
11
11
  import i18n from '../config/i18n';
12
- import { languageRegistry, getDefaultLanguage } from '../config/languagesData';
12
+ import { languageRegistry } from '../config/languagesData';
13
13
  import { getDeviceLocale } from '../config/languages';
14
14
 
15
15
  const LANGUAGE_STORAGE_KEY = '@localization:language';
@@ -36,7 +36,6 @@ 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 || '';
40
39
 
41
40
  const currentLang = getLanguageByCode(currentLanguage);
42
41
  const defaultLanguageDisplay = config?.defaultLanguageDisplay || 'English';