@umituz/react-native-localization 1.5.9 → 1.6.1
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/locales/en-US/auth.json +0 -2
- package/src/infrastructure/locales/en-US/branding.json +0 -1
- package/src/infrastructure/locales/en-US/datetime.json +1 -3
- package/src/infrastructure/locales/en-US/errors.json +0 -2
- package/src/infrastructure/locales/en-US/general.json +1 -1
- package/src/infrastructure/locales/en-US/index.ts +1 -1
- package/src/infrastructure/locales/en-US/navigation.json +4 -4
- package/src/infrastructure/locales/en-US/onboarding.json +0 -8
- package/src/infrastructure/storage/LocalizationStore.ts +24 -4
package/package.json
CHANGED
|
@@ -24,8 +24,6 @@
|
|
|
24
24
|
"loginFailed": "Login failed. Please check your credentials.",
|
|
25
25
|
"registrationFailed": "Registration failed. Please try again.",
|
|
26
26
|
"logout": "Logout",
|
|
27
|
-
"profile": "Profile",
|
|
28
|
-
"account": "Account",
|
|
29
27
|
"signedInAs": "Signed in as",
|
|
30
28
|
"guestMode": "Guest Mode",
|
|
31
29
|
"guestModeDescription": "Your data is stored locally on this device",
|
|
@@ -61,7 +61,6 @@
|
|
|
61
61
|
"relative": {
|
|
62
62
|
"now": "Now",
|
|
63
63
|
"justNow": "Just now",
|
|
64
|
-
"today": "Today",
|
|
65
64
|
"yesterday": "Yesterday",
|
|
66
65
|
"tomorrow": "Tomorrow",
|
|
67
66
|
"thisWeek": "This week",
|
|
@@ -134,7 +133,6 @@
|
|
|
134
133
|
"clearDate": "Clear Date",
|
|
135
134
|
"clearTime": "Clear Time",
|
|
136
135
|
"confirmDate": "Confirm Date",
|
|
137
|
-
"confirmTime": "Confirm Time"
|
|
138
|
-
"cancel": "Cancel"
|
|
136
|
+
"confirmTime": "Confirm Time"
|
|
139
137
|
}
|
|
140
138
|
}
|
|
@@ -29,14 +29,12 @@
|
|
|
29
29
|
"photosNotAvailable": "Photo library not available"
|
|
30
30
|
},
|
|
31
31
|
"common": {
|
|
32
|
-
"somethingWentWrong": "Something went wrong",
|
|
33
32
|
"tryAgainLater": "Please try again later",
|
|
34
33
|
"unexpectedError": "An unexpected error occurred"
|
|
35
34
|
},
|
|
36
35
|
"actions": {
|
|
37
36
|
"dismiss": "Dismiss",
|
|
38
37
|
"retry": "Retry",
|
|
39
|
-
"cancel": "Cancel",
|
|
40
38
|
"goBack": "Go Back",
|
|
41
39
|
"contactSupport": "Contact Support"
|
|
42
40
|
}
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
"skip": "Skip",
|
|
20
20
|
"retry": "Retry",
|
|
21
21
|
"refresh": "Refresh",
|
|
22
|
-
"search": "Search",
|
|
23
22
|
"filter": "Filter",
|
|
24
23
|
"sort": "Sort",
|
|
25
24
|
"add": "Add",
|
|
@@ -53,5 +52,6 @@
|
|
|
53
52
|
"viewAll": "View all",
|
|
54
53
|
"showMore": "Show more",
|
|
55
54
|
"showLess": "Show less",
|
|
55
|
+
"back": "Back",
|
|
56
56
|
"start": "Start"
|
|
57
57
|
}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* This file is automatically generated by setup-languages.js or createLocaleLoaders.js
|
|
21
21
|
* but can be manually edited if needed.
|
|
22
22
|
*
|
|
23
|
-
* Generated: 2025-11-13T00:
|
|
23
|
+
* Generated: 2025-11-13T00:52:59.500Z
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
// Metro bundler require.context - auto-discover all .json files
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"home": "Home",
|
|
3
|
-
"settings": "Settings",
|
|
4
|
-
"about": "About",
|
|
5
3
|
"explore": "Explore",
|
|
6
4
|
"search": "Search",
|
|
7
5
|
"favorites": "Favorites",
|
|
@@ -15,9 +13,11 @@
|
|
|
15
13
|
"categories": "Categories",
|
|
16
14
|
"saved": "Saved",
|
|
17
15
|
"history": "History",
|
|
18
|
-
"today": "Today",
|
|
19
16
|
"statistics": "Statistics",
|
|
20
17
|
"reminders": "Reminders",
|
|
21
18
|
"profile": "Profile",
|
|
22
|
-
"account": "Account"
|
|
19
|
+
"account": "Account",
|
|
20
|
+
"settings": "Settings",
|
|
21
|
+
"about": "About",
|
|
22
|
+
"today": "Today"
|
|
23
23
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
"skip": "Skip",
|
|
3
|
-
"getStarted": "Get Started",
|
|
4
2
|
"welcome": {
|
|
5
3
|
"title": "Welcome!",
|
|
6
4
|
"subtitle": "Get started",
|
|
@@ -56,11 +54,5 @@
|
|
|
56
54
|
"title": "You're All Set!",
|
|
57
55
|
"subtitle": "Let's get started!",
|
|
58
56
|
"startButton": "Start Using App"
|
|
59
|
-
},
|
|
60
|
-
"navigation": {
|
|
61
|
-
"next": "Next",
|
|
62
|
-
"back": "Back",
|
|
63
|
-
"skip": "Skip",
|
|
64
|
-
"done": "Done"
|
|
65
57
|
}
|
|
66
58
|
}
|
|
@@ -117,6 +117,7 @@ export const useLocalizationStore = create<LocalizationState>((set, get) => ({
|
|
|
117
117
|
* Hook to use localization
|
|
118
118
|
* Provides current language, RTL state, language switching, and translation function
|
|
119
119
|
* Uses react-i18next's useTranslation hook to ensure proper i18n instance
|
|
120
|
+
* Falls back to direct i18n.t if react-i18next is not ready
|
|
120
121
|
*/
|
|
121
122
|
export const useLocalization = () => {
|
|
122
123
|
const {
|
|
@@ -130,12 +131,31 @@ export const useLocalization = () => {
|
|
|
130
131
|
|
|
131
132
|
const currentLanguageObject = getLanguageByCode(currentLanguage);
|
|
132
133
|
|
|
133
|
-
//
|
|
134
|
-
//
|
|
135
|
-
const
|
|
134
|
+
// Check if i18n is initialized and react-i18next is ready
|
|
135
|
+
// If not, use direct i18n.t as fallback
|
|
136
|
+
const isI18nReady = i18n.isInitialized && typeof i18n.t === 'function';
|
|
137
|
+
|
|
138
|
+
// Always call useTranslation hook (React hooks rules)
|
|
139
|
+
// But use fallback if i18n is not ready
|
|
140
|
+
let translationResult;
|
|
141
|
+
try {
|
|
142
|
+
translationResult = useTranslation();
|
|
143
|
+
} catch (error) {
|
|
144
|
+
// If useTranslation fails, we'll use direct i18n.t
|
|
145
|
+
translationResult = null;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Use translation function from react-i18next if available, otherwise use direct i18n.t
|
|
149
|
+
const t: (key: string, options?: any) => string = translationResult?.t || ((key: string, options?: any) => {
|
|
150
|
+
if (isI18nReady) {
|
|
151
|
+
return i18n.t(key, options);
|
|
152
|
+
}
|
|
153
|
+
// Final fallback: return key if i18n is not ready
|
|
154
|
+
return key;
|
|
155
|
+
});
|
|
136
156
|
|
|
137
157
|
return {
|
|
138
|
-
t, // Translation function from react-i18next
|
|
158
|
+
t, // Translation function from react-i18next or i18n fallback
|
|
139
159
|
currentLanguage,
|
|
140
160
|
currentLanguageObject,
|
|
141
161
|
isRTL,
|