@umituz/react-native-localization 1.7.2 → 1.7.3

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": "1.7.2",
3
+ "version": "1.7.3",
4
4
  "description": "Universal localization system for React Native apps with i18n support",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -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-13T02:01:18.323Z
23
+ * Generated: 2025-11-13T02:42:52.919Z
24
24
  */
25
25
 
26
26
  // Metro bundler require.context - auto-discover all .json files
@@ -140,16 +140,21 @@ export const useLocalization = () => {
140
140
 
141
141
  // Use translation function from react-i18next if available and valid
142
142
  // Otherwise fallback to direct i18n.t
143
- const t: (key: string, options?: any) => string = (translationResult?.t && typeof translationResult.t === 'function' && i18n.isInitialized)
144
- ? translationResult.t
145
- : ((key: string, options?: any) => {
143
+ // Type assertion needed because react-i18next's TFunction can return string | object
144
+ const t = (translationResult?.t && typeof translationResult.t === 'function' && i18n.isInitialized)
145
+ ? ((key: string, options?: any): string => {
146
+ const result = translationResult.t(key, options);
147
+ return typeof result === 'string' ? result : String(result);
148
+ })
149
+ : ((key: string, options?: any): string => {
146
150
  // Fallback to direct i18n.t if react-i18next is not ready
147
151
  if (i18n.isInitialized && typeof i18n.t === 'function') {
148
- return i18n.t(key, options);
152
+ const result = i18n.t(key, options);
153
+ return typeof result === 'string' ? result : String(result);
149
154
  }
150
155
  // Final fallback: return key if i18n is not ready
151
156
  return key;
152
- });
157
+ }) as (key: string, options?: any) => string;
153
158
 
154
159
  return {
155
160
  t, // Translation function from react-i18next or i18n fallback