@umituz/react-native-localization 2.2.1 → 2.2.2

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": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "description": "English-only localization system for React Native apps with i18n support",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -14,6 +14,55 @@ import i18n from '../config/i18n';
14
14
  * Hook for translation functionality
15
15
  */
16
16
  export const useTranslationFunction = (): ((key: string, options?: any) => string) => {
17
+ // Ensure settings translations are loaded
18
+ if (i18n.isInitialized && typeof i18n.t === 'function') {
19
+ const existingTranslations = i18n.getResourceBundle('en-US', 'translation') || {};
20
+
21
+ // Check if settings translations are missing
22
+ if (!existingTranslations.settings) {
23
+ // Add settings translations as fallback
24
+ const settingsTranslations = {
25
+ settings: {
26
+ editProfile: "Edit Profile",
27
+ sections: {
28
+ physicalInfoAndGoals: "Physical Info and Goals",
29
+ appSettings: "App Settings",
30
+ accountManagement: "Account Management"
31
+ },
32
+ personalInfo: {
33
+ title: "Personal Information",
34
+ subtitle: "Height, Weight, Age, Gender"
35
+ },
36
+ nutritionGoals: {
37
+ title: "Nutrition Goals",
38
+ subtitle: "Calories, Protein, Carbs, Fat"
39
+ },
40
+ notifications: {
41
+ title: "Notification Preferences",
42
+ subtitle: "Water and meal reminders"
43
+ },
44
+ darkMode: {
45
+ title: "Dark Mode",
46
+ subtitle: "Change app theme"
47
+ },
48
+ passwordChange: {
49
+ title: "Change Password"
50
+ },
51
+ saveChanges: "Save Changes",
52
+ logout: "Logout",
53
+ emptyState: {
54
+ title: "No recipes yet",
55
+ subtitle: "Create your first recipe to get started"
56
+ },
57
+ addToList: "Add to List"
58
+ }
59
+ };
60
+
61
+ const mergedTranslations = { ...existingTranslations, ...settingsTranslations };
62
+ i18n.addResourceBundle('en-US', 'translation', mergedTranslations, true, true);
63
+ }
64
+ }
65
+
17
66
  // Use direct i18n.t for reliability (no React context issues)
18
67
  return (key: string, options?: any): string => {
19
68
  if (i18n.isInitialized && typeof i18n.t === 'function') {