gt-react-native 11.0.0-odysseus.4 → 11.0.0

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.
Files changed (101) hide show
  1. package/dist/commonjs/NativeGtReactNative.js +3 -6
  2. package/dist/commonjs/NativeGtReactNative.js.map +1 -1
  3. package/dist/commonjs/condition-store/NativeConditionStore.js +19 -27
  4. package/dist/commonjs/condition-store/NativeConditionStore.js.map +1 -1
  5. package/dist/commonjs/hooks/selectors.js.map +1 -1
  6. package/dist/commonjs/index.js +35 -10
  7. package/dist/commonjs/plugin-dir/index.js +3 -6
  8. package/dist/commonjs/plugin-dir/index.js.map +1 -1
  9. package/dist/commonjs/plugin.js +2 -5
  10. package/dist/commonjs/provider/GTProvider.js +32 -21
  11. package/dist/commonjs/provider/GTProvider.js.map +1 -1
  12. package/dist/commonjs/provider/NativeGTProvider.js +1 -4
  13. package/dist/commonjs/provider/NativeGTProvider.js.map +1 -1
  14. package/dist/commonjs/setup/initializeGT.js +6 -11
  15. package/dist/commonjs/utils/getInitialNativeConditions.js +2 -2
  16. package/dist/commonjs/utils/getInitialNativeConditions.js.map +1 -1
  17. package/dist/commonjs/utils/getLocale.js +1 -1
  18. package/dist/commonjs/utils/getLocale.js.map +1 -1
  19. package/dist/commonjs/utils/getNativeLocales.js +1 -1
  20. package/dist/commonjs/utils/getNativeLocales.js.map +1 -1
  21. package/dist/commonjs/utils/nativeStore.js +4 -4
  22. package/dist/commonjs/utils/nativeStore.js.map +1 -1
  23. package/dist/commonjs/utils/resolveLocale.js +1 -2
  24. package/dist/commonjs/utils/resolveLocale.js.map +1 -1
  25. package/dist/module/NativeGtReactNative.d.ts +1 -2
  26. package/dist/module/NativeGtReactNative.d.ts.map +1 -1
  27. package/dist/module/NativeGtReactNative.js +2 -2
  28. package/dist/module/NativeGtReactNative.js.map +1 -1
  29. package/dist/module/condition-store/NativeConditionStore.d.ts +0 -7
  30. package/dist/module/condition-store/NativeConditionStore.d.ts.map +1 -1
  31. package/dist/module/condition-store/NativeConditionStore.js +20 -28
  32. package/dist/module/condition-store/NativeConditionStore.js.map +1 -1
  33. package/dist/module/hooks/selectors.d.ts +3 -33
  34. package/dist/module/hooks/selectors.d.ts.map +1 -1
  35. package/dist/module/hooks/selectors.js.map +1 -1
  36. package/dist/module/index.d.ts +13 -18
  37. package/dist/module/index.d.ts.map +1 -1
  38. package/dist/module/index.js +3 -4
  39. package/dist/module/plugin-dir/index.d.ts +1 -1
  40. package/dist/module/plugin-dir/index.d.ts.map +1 -1
  41. package/dist/module/plugin-dir/index.js +2 -2
  42. package/dist/module/plugin-dir/index.js.map +1 -1
  43. package/dist/module/plugin.d.ts +1 -1
  44. package/dist/module/plugin.d.ts.map +1 -1
  45. package/dist/module/plugin.js +2 -2
  46. package/dist/module/provider/GTProvider.d.ts +1 -1
  47. package/dist/module/provider/GTProvider.d.ts.map +1 -1
  48. package/dist/module/provider/GTProvider.js +32 -21
  49. package/dist/module/provider/GTProvider.js.map +1 -1
  50. package/dist/module/provider/NativeGTProvider.d.ts.map +1 -1
  51. package/dist/module/provider/NativeGTProvider.js +1 -4
  52. package/dist/module/provider/NativeGTProvider.js.map +1 -1
  53. package/dist/module/setup/initializeGT.d.ts +3 -4
  54. package/dist/module/setup/initializeGT.d.ts.map +1 -1
  55. package/dist/module/setup/initializeGT.js +1 -11
  56. package/dist/module/utils/getInitialNativeConditions.d.ts.map +1 -1
  57. package/dist/module/utils/getInitialNativeConditions.js +3 -3
  58. package/dist/module/utils/getInitialNativeConditions.js.map +1 -1
  59. package/dist/module/utils/getLocale.d.ts.map +1 -1
  60. package/dist/module/utils/getLocale.js +2 -2
  61. package/dist/module/utils/getLocale.js.map +1 -1
  62. package/dist/module/utils/getNativeLocales.js +2 -2
  63. package/dist/module/utils/getNativeLocales.js.map +1 -1
  64. package/dist/module/utils/nativeStore.d.ts +1 -1
  65. package/dist/module/utils/nativeStore.d.ts.map +1 -1
  66. package/dist/module/utils/nativeStore.js +6 -6
  67. package/dist/module/utils/nativeStore.js.map +1 -1
  68. package/dist/module/utils/resolveLocale.d.ts.map +1 -1
  69. package/dist/module/utils/resolveLocale.js +1 -2
  70. package/dist/module/utils/resolveLocale.js.map +1 -1
  71. package/package.json +6 -6
  72. package/src/NativeGtReactNative.ts +2 -1
  73. package/src/condition-store/NativeConditionStore.ts +21 -40
  74. package/src/hooks/selectors.ts +17 -3
  75. package/src/index.tsx +39 -67
  76. package/src/plugin-dir/index.ts +1 -1
  77. package/src/plugin.ts +1 -1
  78. package/src/provider/GTProvider.tsx +51 -29
  79. package/src/provider/NativeGTProvider.tsx +1 -9
  80. package/src/setup/initializeGT.ts +7 -19
  81. package/src/utils/getInitialNativeConditions.ts +3 -6
  82. package/src/utils/getLocale.ts +2 -2
  83. package/src/utils/getNativeLocales.ts +1 -1
  84. package/src/utils/nativeStore.ts +4 -4
  85. package/src/utils/resolveLocale.ts +1 -5
  86. package/dist/commonjs/hooks/utils.js +0 -17
  87. package/dist/commonjs/hooks/utils.js.map +0 -1
  88. package/dist/commonjs/setup/initializeGT.js.map +0 -1
  89. package/dist/commonjs/utils/utils.js +0 -13
  90. package/dist/commonjs/utils/utils.js.map +0 -1
  91. package/dist/module/hooks/utils.d.ts +0 -3
  92. package/dist/module/hooks/utils.d.ts.map +0 -1
  93. package/dist/module/hooks/utils.js +0 -14
  94. package/dist/module/hooks/utils.js.map +0 -1
  95. package/dist/module/setup/initializeGT.js.map +0 -1
  96. package/dist/module/utils/utils.d.ts +0 -3
  97. package/dist/module/utils/utils.d.ts.map +0 -1
  98. package/dist/module/utils/utils.js +0 -12
  99. package/dist/module/utils/utils.js.map +0 -1
  100. package/src/hooks/utils.ts +0 -14
  101. package/src/utils/utils.ts +0 -12
@@ -1,11 +1,8 @@
1
- Object.defineProperties(exports, {
2
- __esModule: { value: true },
3
- [Symbol.toStringTag]: { value: "Module" }
4
- });
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
5
2
  require("./_virtual/_rolldown/runtime.js");
6
3
  //#region src/NativeGtReactNative.ts
7
- var NativeGtReactNative_default = require("react-native").TurboModuleRegistry.getEnforcing("GtReactNative");
4
+ const GtReactNative = require("react-native").TurboModuleRegistry.getEnforcing("GtReactNative");
8
5
  //#endregion
9
- exports.default = NativeGtReactNative_default;
6
+ exports.GtReactNative = GtReactNative;
10
7
 
11
8
  //# sourceMappingURL=NativeGtReactNative.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NativeGtReactNative.js","names":["TurboModuleRegistry"],"sources":["../../src/NativeGtReactNative.ts"],"sourcesContent":["import type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\nexport interface Spec extends TurboModule {\n multiply(a: number, b: number): number;\n getNativeLocales(): string[];\n nativeStoreGet(key: string): string | null;\n nativeStoreSet(key: string, value: string): void;\n}\n\nexport default TurboModuleRegistry.getEnforcing<Spec>('GtReactNative');\n"],"mappings":";;;;;;AASA,IAAA,qDAAeA,CAAAA,oBAAoB,aAAmB,gBAAgB"}
1
+ {"version":3,"file":"NativeGtReactNative.js","names":["TurboModuleRegistry"],"sources":["../../src/NativeGtReactNative.ts"],"sourcesContent":["import type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\nexport interface Spec extends TurboModule {\n multiply(a: number, b: number): number;\n getNativeLocales(): string[];\n nativeStoreGet(key: string): string | null;\n nativeStoreSet(key: string, value: string): void;\n}\n\nexport const GtReactNative =\n TurboModuleRegistry.getEnforcing<Spec>('GtReactNative');\n"],"mappings":";;;AASA,MAAa,uCACXA,CAAAA,oBAAoB,aAAmB,gBAAgB"}
@@ -10,61 +10,44 @@ let _generaltranslation_react_core_pure = require("@generaltranslation/react-cor
10
10
  * Condition store implementation for React Native.
11
11
  */
12
12
  var NativeConditionStore = class {
13
- localeStoreKey;
14
- regionStoreKey;
15
- enableI18nStoreKey;
16
13
  customReload;
17
14
  constructor(config) {
18
15
  this.customReload = config._reload ?? (() => void 0);
19
- this.localeStoreKey = config.localeStoreKey ?? _generaltranslation_react_core_pure.defaultLocaleCookieName;
20
- this.regionStoreKey = config.regionStoreKey ?? _generaltranslation_react_core_pure.defaultRegionCookieName;
21
- this.enableI18nStoreKey = config.enableI18nStoreKey ?? _generaltranslation_react_core_pure.defaultEnableI18nCookieName;
22
- this.updateLocale(config.locale ?? require_utils_getLocale.getLocale({ localeStoreKey: this.localeStoreKey }));
23
- const region = require_utils_getInitialNativeConditions.getInitialRegion({
24
- region: config.region,
25
- regionStoreKey: this.regionStoreKey
26
- });
16
+ this.updateLocale(config.locale ?? require_utils_getLocale.getLocale());
17
+ const region = require_utils_getInitialNativeConditions.getInitialRegion({ region: config.region });
27
18
  if (region !== void 0) this.updateRegion(region);
28
- this.updateEnableI18n(require_utils_getInitialNativeConditions.getInitialEnableI18n({
29
- enableI18n: config.enableI18n,
30
- enableI18nStoreKey: this.enableI18nStoreKey
31
- }));
19
+ this.updateEnableI18n(require_utils_getInitialNativeConditions.getInitialEnableI18n({ enableI18n: config.enableI18n }));
32
20
  }
33
- updateConfig = ({ localeStoreKey, regionStoreKey, enableI18nStoreKey }) => {
34
- this.localeStoreKey = localeStoreKey ?? _generaltranslation_react_core_pure.defaultLocaleCookieName;
35
- this.regionStoreKey = regionStoreKey ?? _generaltranslation_react_core_pure.defaultRegionCookieName;
36
- this.enableI18nStoreKey = enableI18nStoreKey ?? _generaltranslation_react_core_pure.defaultEnableI18nCookieName;
37
- };
38
21
  getLocale = () => {
39
- return require_utils_getLocale.getLocale({ localeStoreKey: this.localeStoreKey });
22
+ return require_utils_getLocale.getLocale();
40
23
  };
41
24
  setLocale = (locale) => {
42
25
  const nextLocale = require_utils_resolveLocale.resolveLocale(locale);
43
- require_utils_nativeStore.nativeStoreSet(this.localeStoreKey, nextLocale);
26
+ require_utils_nativeStore.nativeStoreSet(getLocaleStoreKey(), nextLocale);
44
27
  this.reload({ locale: nextLocale });
45
28
  };
46
29
  getRegion = () => {
47
- return require_utils_nativeStore.nativeStoreGet(this.regionStoreKey) || void 0;
30
+ return require_utils_nativeStore.nativeStoreGet(getRegionStoreKey()) || void 0;
48
31
  };
49
32
  setRegion = (region) => {
50
33
  this.updateRegion(region);
51
34
  this.reload({ region });
52
35
  };
53
36
  getEnableI18n = () => {
54
- return require_utils_nativeStore.nativeStoreGet(this.enableI18nStoreKey) !== "false";
37
+ return require_utils_nativeStore.nativeStoreGet(getEnableI18nStoreKey()) !== "false";
55
38
  };
56
39
  setEnableI18n = (enableI18n) => {
57
40
  this.updateEnableI18n(enableI18n);
58
41
  this.reload({ enableI18n });
59
42
  };
60
43
  updateLocale = (locale) => {
61
- require_utils_nativeStore.nativeStoreSet(this.localeStoreKey, require_utils_resolveLocale.resolveLocale(locale));
44
+ require_utils_nativeStore.nativeStoreSet(getLocaleStoreKey(), require_utils_resolveLocale.resolveLocale(locale));
62
45
  };
63
46
  updateRegion = (region) => {
64
- require_utils_nativeStore.nativeStoreSet(this.regionStoreKey, region ?? "");
47
+ require_utils_nativeStore.nativeStoreSet(getRegionStoreKey(), region ?? "");
65
48
  };
66
49
  updateEnableI18n = (enableI18n) => {
67
- require_utils_nativeStore.nativeStoreSet(this.enableI18nStoreKey, enableI18n ? "true" : "false");
50
+ require_utils_nativeStore.nativeStoreSet(getEnableI18nStoreKey(), enableI18n ? "true" : "false");
68
51
  };
69
52
  reload = (state = {}) => {
70
53
  this.customReload({
@@ -74,6 +57,15 @@ var NativeConditionStore = class {
74
57
  });
75
58
  };
76
59
  };
60
+ function getLocaleStoreKey() {
61
+ return (0, _generaltranslation_react_core_pure.getI18nConfig)().getLocaleCookieName();
62
+ }
63
+ function getRegionStoreKey() {
64
+ return (0, _generaltranslation_react_core_pure.getI18nConfig)().getRegionCookieName();
65
+ }
66
+ function getEnableI18nStoreKey() {
67
+ return (0, _generaltranslation_react_core_pure.getI18nConfig)().getEnableI18nCookieName();
68
+ }
77
69
  //#endregion
78
70
  exports.NativeConditionStore = NativeConditionStore;
79
71
 
@@ -1 +1 @@
1
- {"version":3,"file":"NativeConditionStore.js","names":["defaultLocaleStoreKey","defaultRegionStoreKey","defaultEnableI18nStoreKey","getLocale","getInitialRegion","getInitialEnableI18n","resolveLocale","nativeStoreGet"],"sources":["../../../src/condition-store/NativeConditionStore.ts"],"sourcesContent":["import type {\n LocaleCandidates,\n WritableConditionStoreInterface,\n WritableConditionStoreParams,\n} from 'gt-i18n/internal/types';\nimport {\n defaultEnableI18nCookieName as defaultEnableI18nStoreKey,\n defaultLocaleCookieName as defaultLocaleStoreKey,\n defaultRegionCookieName as defaultRegionStoreKey,\n} from '@generaltranslation/react-core/pure';\nimport { getLocale } from '../utils/getLocale';\nimport {\n getInitialEnableI18n,\n getInitialRegion,\n} from '../utils/getInitialNativeConditions';\nimport { nativeStoreGet, nativeStoreSet } from '../utils/nativeStore';\nimport { resolveLocale } from '../utils/resolveLocale';\n\nexport type NativeConditionStoreParams = WritableConditionStoreParams & {\n localeStoreKey?: string;\n regionStoreKey?: string;\n enableI18nStoreKey?: string;\n _reload?: ReloadType;\n};\n\nexport type NativeConditionStoreState = {\n locale: string;\n region: string | undefined;\n enableI18n: boolean;\n};\n\nexport type ReloadType = (state: NativeConditionStoreState) => void;\n\n/**\n * Condition store implementation for React Native.\n */\nexport class NativeConditionStore implements WritableConditionStoreInterface {\n private localeStoreKey: string;\n private regionStoreKey: string;\n private enableI18nStoreKey: string;\n private customReload: ReloadType;\n\n constructor(config: NativeConditionStoreParams) {\n this.customReload = config._reload ?? (() => undefined);\n this.localeStoreKey = config.localeStoreKey ?? defaultLocaleStoreKey;\n this.regionStoreKey = config.regionStoreKey ?? defaultRegionStoreKey;\n this.enableI18nStoreKey =\n config.enableI18nStoreKey ?? defaultEnableI18nStoreKey;\n\n this.updateLocale(\n config.locale ?? getLocale({ localeStoreKey: this.localeStoreKey })\n );\n const region = getInitialRegion({\n region: config.region,\n regionStoreKey: this.regionStoreKey,\n });\n if (region !== undefined) {\n this.updateRegion(region);\n }\n this.updateEnableI18n(\n getInitialEnableI18n({\n enableI18n: config.enableI18n,\n enableI18nStoreKey: this.enableI18nStoreKey,\n })\n );\n }\n\n updateConfig = ({\n localeStoreKey,\n regionStoreKey,\n enableI18nStoreKey,\n }: Pick<\n NativeConditionStoreParams,\n 'localeStoreKey' | 'regionStoreKey' | 'enableI18nStoreKey'\n >): void => {\n this.localeStoreKey = localeStoreKey ?? defaultLocaleStoreKey;\n this.regionStoreKey = regionStoreKey ?? defaultRegionStoreKey;\n this.enableI18nStoreKey = enableI18nStoreKey ?? defaultEnableI18nStoreKey;\n };\n\n getLocale = (): string => {\n return getLocale({ localeStoreKey: this.localeStoreKey });\n };\n\n setLocale = (locale: LocaleCandidates): void => {\n const nextLocale = resolveLocale(locale);\n nativeStoreSet(this.localeStoreKey, nextLocale);\n this.reload({ locale: nextLocale });\n };\n\n getRegion = (): string | undefined => {\n return nativeStoreGet(this.regionStoreKey) || undefined;\n };\n\n setRegion = (region: string | undefined): void => {\n this.updateRegion(region);\n this.reload({ region });\n };\n\n getEnableI18n = (): boolean => {\n return nativeStoreGet(this.enableI18nStoreKey) !== 'false';\n };\n\n setEnableI18n = (enableI18n: boolean): void => {\n this.updateEnableI18n(enableI18n);\n this.reload({ enableI18n });\n };\n\n updateLocale = (locale: LocaleCandidates): void => {\n nativeStoreSet(this.localeStoreKey, resolveLocale(locale));\n };\n\n updateRegion = (region: string | undefined): void => {\n nativeStoreSet(this.regionStoreKey, region ?? '');\n };\n\n updateEnableI18n = (enableI18n: boolean): void => {\n nativeStoreSet(this.enableI18nStoreKey, enableI18n ? 'true' : 'false');\n };\n\n reload = (state: Partial<NativeConditionStoreState> = {}): void => {\n this.customReload({\n locale: state.locale ?? this.getLocale(),\n region: 'region' in state ? state.region : this.getRegion(),\n enableI18n: state.enableI18n ?? this.getEnableI18n(),\n });\n };\n}\n"],"mappings":";;;;;;;;;;;AAoCA,IAAa,uBAAb,MAA6E;CAC3E;CACA;CACA;CACA;CAEA,YAAY,QAAoC;AAC9C,OAAK,eAAe,OAAO,kBAAkB,KAAA;AAC7C,OAAK,iBAAiB,OAAO,kBAAkBA,oCAAAA;AAC/C,OAAK,iBAAiB,OAAO,kBAAkBC,oCAAAA;AAC/C,OAAK,qBACH,OAAO,sBAAsBC,oCAAAA;AAE/B,OAAK,aACH,OAAO,UAAUC,wBAAAA,UAAU,EAAE,gBAAgB,KAAK,gBAAgB,CAAC,CACpE;EACD,MAAM,SAASC,yCAAAA,iBAAiB;GAC9B,QAAQ,OAAO;GACf,gBAAgB,KAAK;GACtB,CAAC;AACF,MAAI,WAAW,KAAA,EACb,MAAK,aAAa,OAAO;AAE3B,OAAK,iBACHC,yCAAAA,qBAAqB;GACnB,YAAY,OAAO;GACnB,oBAAoB,KAAK;GAC1B,CAAC,CACH;;CAGH,gBAAgB,EACd,gBACA,gBACA,yBAIU;AACV,OAAK,iBAAiB,kBAAkBL,oCAAAA;AACxC,OAAK,iBAAiB,kBAAkBC,oCAAAA;AACxC,OAAK,qBAAqB,sBAAsBC,oCAAAA;;CAGlD,kBAA0B;AACxB,SAAOC,wBAAAA,UAAU,EAAE,gBAAgB,KAAK,gBAAgB,CAAC;;CAG3D,aAAa,WAAmC;EAC9C,MAAM,aAAaG,4BAAAA,cAAc,OAAO;AACxC,4BAAA,eAAe,KAAK,gBAAgB,WAAW;AAC/C,OAAK,OAAO,EAAE,QAAQ,YAAY,CAAC;;CAGrC,kBAAsC;AACpC,SAAOC,0BAAAA,eAAe,KAAK,eAAe,IAAI,KAAA;;CAGhD,aAAa,WAAqC;AAChD,OAAK,aAAa,OAAO;AACzB,OAAK,OAAO,EAAE,QAAQ,CAAC;;CAGzB,sBAA+B;AAC7B,SAAOA,0BAAAA,eAAe,KAAK,mBAAmB,KAAK;;CAGrD,iBAAiB,eAA8B;AAC7C,OAAK,iBAAiB,WAAW;AACjC,OAAK,OAAO,EAAE,YAAY,CAAC;;CAG7B,gBAAgB,WAAmC;AACjD,4BAAA,eAAe,KAAK,gBAAgBD,4BAAAA,cAAc,OAAO,CAAC;;CAG5D,gBAAgB,WAAqC;AACnD,4BAAA,eAAe,KAAK,gBAAgB,UAAU,GAAG;;CAGnD,oBAAoB,eAA8B;AAChD,4BAAA,eAAe,KAAK,oBAAoB,aAAa,SAAS,QAAQ;;CAGxE,UAAU,QAA4C,EAAE,KAAW;AACjE,OAAK,aAAa;GAChB,QAAQ,MAAM,UAAU,KAAK,WAAW;GACxC,QAAQ,YAAY,QAAQ,MAAM,SAAS,KAAK,WAAW;GAC3D,YAAY,MAAM,cAAc,KAAK,eAAe;GACrD,CAAC"}
1
+ {"version":3,"file":"NativeConditionStore.js","names":["getLocale","getInitialRegion","getInitialEnableI18n","resolveLocale","nativeStoreGet"],"sources":["../../../src/condition-store/NativeConditionStore.ts"],"sourcesContent":["import type {\n LocaleCandidates,\n WritableConditionStoreInterface,\n WritableConditionStoreParams,\n} from 'gt-i18n/internal/types';\nimport { getI18nConfig } from '@generaltranslation/react-core/pure';\nimport { getLocale } from '../utils/getLocale';\nimport {\n getInitialEnableI18n,\n getInitialRegion,\n} from '../utils/getInitialNativeConditions';\nimport { nativeStoreGet, nativeStoreSet } from '../utils/nativeStore';\nimport { resolveLocale } from '../utils/resolveLocale';\n\nexport type NativeConditionStoreParams = WritableConditionStoreParams & {\n _reload?: ReloadType;\n};\n\nexport type NativeConditionStoreState = {\n locale: string;\n region: string | undefined;\n enableI18n: boolean;\n};\n\nexport type ReloadType = (state: NativeConditionStoreState) => void;\n\n/**\n * Condition store implementation for React Native.\n */\nexport class NativeConditionStore implements WritableConditionStoreInterface {\n private customReload: ReloadType;\n\n constructor(config: NativeConditionStoreParams) {\n this.customReload = config._reload ?? (() => undefined);\n\n this.updateLocale(config.locale ?? getLocale());\n const region = getInitialRegion({\n region: config.region,\n });\n if (region !== undefined) {\n this.updateRegion(region);\n }\n this.updateEnableI18n(\n getInitialEnableI18n({\n enableI18n: config.enableI18n,\n })\n );\n }\n\n getLocale = (): string => {\n return getLocale();\n };\n\n setLocale = (locale: LocaleCandidates): void => {\n const nextLocale = resolveLocale(locale);\n nativeStoreSet(getLocaleStoreKey(), nextLocale);\n this.reload({ locale: nextLocale });\n };\n\n getRegion = (): string | undefined => {\n return nativeStoreGet(getRegionStoreKey()) || undefined;\n };\n\n setRegion = (region: string | undefined): void => {\n this.updateRegion(region);\n this.reload({ region });\n };\n\n getEnableI18n = (): boolean => {\n return nativeStoreGet(getEnableI18nStoreKey()) !== 'false';\n };\n\n setEnableI18n = (enableI18n: boolean): void => {\n this.updateEnableI18n(enableI18n);\n this.reload({ enableI18n });\n };\n\n updateLocale = (locale: LocaleCandidates): void => {\n nativeStoreSet(getLocaleStoreKey(), resolveLocale(locale));\n };\n\n updateRegion = (region: string | undefined): void => {\n nativeStoreSet(getRegionStoreKey(), region ?? '');\n };\n\n updateEnableI18n = (enableI18n: boolean): void => {\n nativeStoreSet(getEnableI18nStoreKey(), enableI18n ? 'true' : 'false');\n };\n\n reload = (state: Partial<NativeConditionStoreState> = {}): void => {\n this.customReload({\n locale: state.locale ?? this.getLocale(),\n region: 'region' in state ? state.region : this.getRegion(),\n enableI18n: state.enableI18n ?? this.getEnableI18n(),\n });\n };\n}\n\nfunction getLocaleStoreKey(): string {\n return getI18nConfig().getLocaleCookieName();\n}\n\nfunction getRegionStoreKey(): string {\n return getI18nConfig().getRegionCookieName();\n}\n\nfunction getEnableI18nStoreKey(): string {\n return getI18nConfig().getEnableI18nCookieName();\n}\n"],"mappings":";;;;;;;;;;;AA6BA,IAAa,uBAAb,MAA6E;CAC3E;CAEA,YAAY,QAAoC;AAC9C,OAAK,eAAe,OAAO,kBAAkB,KAAA;AAE7C,OAAK,aAAa,OAAO,UAAUA,wBAAAA,WAAW,CAAC;EAC/C,MAAM,SAASC,yCAAAA,iBAAiB,EAC9B,QAAQ,OAAO,QAChB,CAAC;AACF,MAAI,WAAW,KAAA,EACb,MAAK,aAAa,OAAO;AAE3B,OAAK,iBACHC,yCAAAA,qBAAqB,EACnB,YAAY,OAAO,YACpB,CAAC,CACH;;CAGH,kBAA0B;AACxB,SAAOF,wBAAAA,WAAW;;CAGpB,aAAa,WAAmC;EAC9C,MAAM,aAAaG,4BAAAA,cAAc,OAAO;AACxC,4BAAA,eAAe,mBAAmB,EAAE,WAAW;AAC/C,OAAK,OAAO,EAAE,QAAQ,YAAY,CAAC;;CAGrC,kBAAsC;AACpC,SAAOC,0BAAAA,eAAe,mBAAmB,CAAC,IAAI,KAAA;;CAGhD,aAAa,WAAqC;AAChD,OAAK,aAAa,OAAO;AACzB,OAAK,OAAO,EAAE,QAAQ,CAAC;;CAGzB,sBAA+B;AAC7B,SAAOA,0BAAAA,eAAe,uBAAuB,CAAC,KAAK;;CAGrD,iBAAiB,eAA8B;AAC7C,OAAK,iBAAiB,WAAW;AACjC,OAAK,OAAO,EAAE,YAAY,CAAC;;CAG7B,gBAAgB,WAAmC;AACjD,4BAAA,eAAe,mBAAmB,EAAED,4BAAAA,cAAc,OAAO,CAAC;;CAG5D,gBAAgB,WAAqC;AACnD,4BAAA,eAAe,mBAAmB,EAAE,UAAU,GAAG;;CAGnD,oBAAoB,eAA8B;AAChD,4BAAA,eAAe,uBAAuB,EAAE,aAAa,SAAS,QAAQ;;CAGxE,UAAU,QAA4C,EAAE,KAAW;AACjE,OAAK,aAAa;GAChB,QAAQ,MAAM,UAAU,KAAK,WAAW;GACxC,QAAQ,YAAY,QAAQ,MAAM,SAAS,KAAK,WAAW;GAC3D,YAAY,MAAM,cAAc,KAAK,eAAe;GACrD,CAAC;;;AAIN,SAAS,oBAA4B;AACnC,SAAA,GAAA,oCAAA,gBAAsB,CAAC,qBAAqB;;AAG9C,SAAS,oBAA4B;AACnC,SAAA,GAAA,oCAAA,gBAAsB,CAAC,qBAAqB;;AAG9C,SAAS,wBAAgC;AACvC,SAAA,GAAA,oCAAA,gBAAsB,CAAC,yBAAyB"}
@@ -1 +1 @@
1
- {"version":3,"file":"selectors.js","names":["useSetLocale","useSetRegion"],"sources":["../../../src/hooks/selectors.ts"],"sourcesContent":["import { useSetLocale, useSetRegion } from './condition-store';\nimport {\n useInternalLocaleSelector,\n useInternalRegionSelector,\n} from '@generaltranslation/react-core/hooks';\nimport type { InternalRegionSelectorOptions } from '@generaltranslation/react-core/hooks';\n\nexport function useLocaleSelector(locales?: string[]) {\n const setLocale = useSetLocale();\n return { setLocale, ...useInternalLocaleSelector(locales) };\n}\n\nexport function useRegionSelector(options?: InternalRegionSelectorOptions) {\n const setLocale = useSetLocale();\n const setRegion = useSetRegion();\n return { setLocale, setRegion, ...useInternalRegionSelector(options) };\n}\n"],"mappings":";;;;;AAOA,SAAgB,kBAAkB,SAAoB;AAEpD,QAAO;EAAE,WADSA,8BAAAA,cACA;EAAE,IAAA,GAAA,qCAAA,2BAA6B,QAAQ;EAAE;;AAG7D,SAAgB,kBAAkB,SAAyC;AAGzE,QAAO;EAAE,WAFSA,8BAAAA,cAEA;EAAE,WADFC,8BAAAA,cACW;EAAE,IAAA,GAAA,qCAAA,2BAA6B,QAAQ;EAAE"}
1
+ {"version":3,"file":"selectors.js","names":["useSetLocale","useSetRegion"],"sources":["../../../src/hooks/selectors.ts"],"sourcesContent":["import { useSetLocale, useSetRegion } from './condition-store';\nimport {\n useInternalLocaleSelector,\n useInternalRegionSelector,\n} from '@generaltranslation/react-core/hooks';\nimport type {\n InternalLocaleSelectorResult,\n InternalRegionSelectorOptions,\n InternalRegionSelectorResult,\n} from '@generaltranslation/react-core/hooks';\n\n// Explicit return types are required: project references make TypeScript try to\n// name the inferred selector types, which otherwise reach into\n// generaltranslation's non-portable bundled declarations (TS2742).\nexport function useLocaleSelector(\n locales?: string[]\n): InternalLocaleSelectorResult & { setLocale: (locale: string) => void } {\n const setLocale = useSetLocale();\n return { setLocale, ...useInternalLocaleSelector(locales) };\n}\n\nexport function useRegionSelector(\n options?: InternalRegionSelectorOptions\n): InternalRegionSelectorResult & {\n setLocale: (locale: string) => void;\n setRegion: (region: string | undefined) => void;\n} {\n const setLocale = useSetLocale();\n const setRegion = useSetRegion();\n return { setLocale, setRegion, ...useInternalRegionSelector(options) };\n}\n"],"mappings":";;;;;AAcA,SAAgB,kBACd,SACwE;AAExE,QAAO;EAAE,WADSA,8BAAAA,cACA;EAAE,IAAA,GAAA,qCAAA,2BAA6B,QAAQ;EAAE;;AAG7D,SAAgB,kBACd,SAIA;AAGA,QAAO;EAAE,WAFSA,8BAAAA,cAEA;EAAE,WADFC,8BAAAA,cACW;EAAE,IAAA,GAAA,qCAAA,2BAA6B,QAAQ;EAAE"}
@@ -5,10 +5,8 @@ const require_utils_getLocale = require("./utils/getLocale.js");
5
5
  const require_provider_GTProvider = require("./provider/GTProvider.js");
6
6
  const require_hooks_condition_store = require("./hooks/condition-store.js");
7
7
  const require_hooks_selectors = require("./hooks/selectors.js");
8
- const require_hooks_utils = require("./hooks/utils.js");
9
- const require_setup_initializeGT = require("./setup/initializeGT.js");
10
- let _generaltranslation_react_core_pure = require("@generaltranslation/react-core/pure");
11
8
  let _generaltranslation_react_core_components = require("@generaltranslation/react-core/components");
9
+ let _generaltranslation_react_core_pure = require("@generaltranslation/react-core/pure");
12
10
  let _generaltranslation_react_core_hooks = require("@generaltranslation/react-core/hooks");
13
11
  Object.defineProperty(exports, "Branch", {
14
12
  enumerable: true,
@@ -101,6 +99,12 @@ Object.defineProperty(exports, "derive", {
101
99
  return _generaltranslation_react_core_pure.derive;
102
100
  }
103
101
  });
102
+ Object.defineProperty(exports, "getDefaultLocale", {
103
+ enumerable: true,
104
+ get: function() {
105
+ return _generaltranslation_react_core_pure.getDefaultLocale;
106
+ }
107
+ });
104
108
  Object.defineProperty(exports, "getFormatLocales", {
105
109
  enumerable: true,
106
110
  get: function() {
@@ -109,6 +113,12 @@ Object.defineProperty(exports, "getFormatLocales", {
109
113
  });
110
114
  exports.getLocale = require_utils_getLocale.getLocale;
111
115
  exports.getLocaleFromNativeStore = require_utils_nativeStore.getLocaleFromNativeStore;
116
+ Object.defineProperty(exports, "getLocales", {
117
+ enumerable: true,
118
+ get: function() {
119
+ return _generaltranslation_react_core_pure.getLocales;
120
+ }
121
+ });
112
122
  Object.defineProperty(exports, "getReactI18nCache", {
113
123
  enumerable: true,
114
124
  get: function() {
@@ -121,13 +131,24 @@ Object.defineProperty(exports, "getTranslationsSnapshot", {
121
131
  return _generaltranslation_react_core_pure.getTranslationsSnapshot;
122
132
  }
123
133
  });
134
+ Object.defineProperty(exports, "getVersionId", {
135
+ enumerable: true,
136
+ get: function() {
137
+ return _generaltranslation_react_core_pure.getVersionId;
138
+ }
139
+ });
124
140
  Object.defineProperty(exports, "gtFallback", {
125
141
  enumerable: true,
126
142
  get: function() {
127
143
  return _generaltranslation_react_core_pure.gtFallback;
128
144
  }
129
145
  });
130
- exports.initializeGT = require_setup_initializeGT.initializeGT;
146
+ Object.defineProperty(exports, "initializeGT", {
147
+ enumerable: true,
148
+ get: function() {
149
+ return _generaltranslation_react_core_pure.internalInitializeGTSRA;
150
+ }
151
+ });
131
152
  Object.defineProperty(exports, "mFallback", {
132
153
  enumerable: true,
133
154
  get: function() {
@@ -140,6 +161,12 @@ Object.defineProperty(exports, "msg", {
140
161
  return _generaltranslation_react_core_pure.msg;
141
162
  }
142
163
  });
164
+ Object.defineProperty(exports, "resolveCanonicalLocale", {
165
+ enumerable: true,
166
+ get: function() {
167
+ return _generaltranslation_react_core_pure.resolveCanonicalLocale;
168
+ }
169
+ });
143
170
  Object.defineProperty(exports, "setReactI18nCache", {
144
171
  enumerable: true,
145
172
  get: function() {
@@ -176,19 +203,18 @@ Object.defineProperty(exports, "useGT", {
176
203
  return _generaltranslation_react_core_hooks.useGT;
177
204
  }
178
205
  });
179
- Object.defineProperty(exports, "useGTClass", {
206
+ Object.defineProperty(exports, "useLocale", {
180
207
  enumerable: true,
181
208
  get: function() {
182
- return _generaltranslation_react_core_hooks.useGTClass;
209
+ return _generaltranslation_react_core_hooks.useLocale;
183
210
  }
184
211
  });
185
- Object.defineProperty(exports, "useLocale", {
212
+ Object.defineProperty(exports, "useLocaleDirection", {
186
213
  enumerable: true,
187
214
  get: function() {
188
- return _generaltranslation_react_core_hooks.useLocale;
215
+ return _generaltranslation_react_core_hooks.useLocaleDirection;
189
216
  }
190
217
  });
191
- exports.useLocaleDirection = require_hooks_utils.useLocaleDirection;
192
218
  Object.defineProperty(exports, "useLocaleProperties", {
193
219
  enumerable: true,
194
220
  get: function() {
@@ -224,4 +250,3 @@ Object.defineProperty(exports, "useTranslations", {
224
250
  return _generaltranslation_react_core_hooks.useTranslations;
225
251
  }
226
252
  });
227
- exports.useVersionId = require_hooks_utils.useVersionId;
@@ -1,14 +1,11 @@
1
- Object.defineProperties(exports, {
2
- __esModule: { value: true },
3
- [Symbol.toStringTag]: { value: "Module" }
4
- });
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
5
2
  const require_runtime = require("../_virtual/_rolldown/runtime.js");
6
3
  const require_plugin_dir_types = require("./types.js");
7
4
  const require_plugin_dir_utils_resolveLocales = require("./utils/resolveLocales.js");
8
5
  let path = require("path");
9
6
  path = require_runtime.__toESM(path);
10
7
  //#region src/plugin-dir/index.ts
11
- function plugin_dir_default(babel, { locales, config, configFilePath, entryPointFilePath = path.resolve(process.cwd(), "src", "App.tsx"), excludePolyfills = [] }) {
8
+ function plugin(babel, { locales, config, configFilePath, entryPointFilePath = path.resolve(process.cwd(), "src", "App.tsx"), excludePolyfills = [] }) {
12
9
  const { types: t } = babel;
13
10
  return {
14
11
  name: "gt-react-native/plugin",
@@ -33,6 +30,6 @@ function plugin_dir_default(babel, { locales, config, configFilePath, entryPoint
33
30
  };
34
31
  }
35
32
  //#endregion
36
- exports.default = plugin_dir_default;
33
+ exports.plugin = plugin;
37
34
 
38
35
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["resolveLocales","POLYFILLS","LOCALE_POLYFILLS"],"sources":["../../../src/plugin-dir/index.ts"],"sourcesContent":["import * as path from 'path';\nimport type { PluginObj, types } from '@babel/core';\nimport { LOCALE_POLYFILLS, POLYFILLS, type PluginOptions } from './types';\nimport { resolveLocales } from './utils/resolveLocales';\n\nexport default function (\n babel: { types: typeof types },\n {\n locales,\n config,\n configFilePath,\n entryPointFilePath = path.resolve(process.cwd(), 'src', 'App.tsx'),\n excludePolyfills = [],\n }: PluginOptions\n): PluginObj {\n const { types: t } = babel;\n\n return {\n name: 'gt-react-native/plugin',\n visitor: {\n Program(programPath, state) {\n const currentFilePath = path.resolve(\n state.filename || state.file.opts.filename || ''\n );\n\n // Only apply polyfills to files that import gt-react-native or generaltranslation\n if (currentFilePath !== entryPointFilePath) {\n return;\n }\n\n const resolvedLocales = resolveLocales({\n locales,\n config,\n configFilePath,\n });\n\n // TODO: smart imports based on if the polyfill is required, do this as a wrapper around AppRegistry.registerComponent()\n const imports = [\n ...POLYFILLS.filter(\n (polyfill) => !excludePolyfills.includes(polyfill)\n ),\n ...resolvedLocales.flatMap((locale) =>\n LOCALE_POLYFILLS.map((localeData) => `${localeData}/${locale}`)\n ),\n ];\n\n const existingImports = new Set<string>();\n programPath.node.body.forEach((node) => {\n if (\n t.isImportDeclaration(node) &&\n typeof node.source.value === 'string' &&\n imports.includes(node.source.value)\n ) {\n existingImports.add(node.source.value);\n }\n });\n\n const importsToAdd = imports.filter((imp) => !existingImports.has(imp));\n\n if (importsToAdd.length > 0) {\n const newImports = importsToAdd.map((importPath) =>\n t.importDeclaration([], t.stringLiteral(importPath))\n );\n\n programPath.node.body.unshift(...newImports);\n }\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;;AAKA,SAAA,mBACE,OACA,EACE,SACA,QACA,gBACA,qBAAqB,KAAK,QAAQ,QAAQ,KAAK,EAAE,OAAO,UAAU,EAClE,mBAAmB,EAAE,IAEZ;CACX,MAAM,EAAE,OAAO,MAAM;AAErB,QAAO;EACL,MAAM;EACN,SAAS,EACP,QAAQ,aAAa,OAAO;AAM1B,OALwB,KAAK,QAC3B,MAAM,YAAY,MAAM,KAAK,KAAK,YAAY,GAI7B,KAAK,mBACtB;GAGF,MAAM,kBAAkBA,wCAAAA,eAAe;IACrC;IACA;IACA;IACD,CAAC;GAGF,MAAM,UAAU,CACd,GAAGC,yBAAAA,UAAU,QACV,aAAa,CAAC,iBAAiB,SAAS,SAAS,CACnD,EACD,GAAG,gBAAgB,SAAS,WAC1BC,yBAAAA,iBAAiB,KAAK,eAAe,GAAG,WAAW,GAAG,SAAS,CAChE,CACF;GAED,MAAM,kCAAkB,IAAI,KAAa;AACzC,eAAY,KAAK,KAAK,SAAS,SAAS;AACtC,QACE,EAAE,oBAAoB,KAAK,IAC3B,OAAO,KAAK,OAAO,UAAU,YAC7B,QAAQ,SAAS,KAAK,OAAO,MAAM,CAEnC,iBAAgB,IAAI,KAAK,OAAO,MAAM;KAExC;GAEF,MAAM,eAAe,QAAQ,QAAQ,QAAQ,CAAC,gBAAgB,IAAI,IAAI,CAAC;AAEvE,OAAI,aAAa,SAAS,GAAG;IAC3B,MAAM,aAAa,aAAa,KAAK,eACnC,EAAE,kBAAkB,EAAE,EAAE,EAAE,cAAc,WAAW,CAAC,CACrD;AAED,gBAAY,KAAK,KAAK,QAAQ,GAAG,WAAW;;KAGjD;EACF"}
1
+ {"version":3,"file":"index.js","names":["resolveLocales","POLYFILLS","LOCALE_POLYFILLS"],"sources":["../../../src/plugin-dir/index.ts"],"sourcesContent":["import * as path from 'path';\nimport type { PluginObj, types } from '@babel/core';\nimport { LOCALE_POLYFILLS, POLYFILLS, type PluginOptions } from './types';\nimport { resolveLocales } from './utils/resolveLocales';\n\nexport function plugin(\n babel: { types: typeof types },\n {\n locales,\n config,\n configFilePath,\n entryPointFilePath = path.resolve(process.cwd(), 'src', 'App.tsx'),\n excludePolyfills = [],\n }: PluginOptions\n): PluginObj {\n const { types: t } = babel;\n\n return {\n name: 'gt-react-native/plugin',\n visitor: {\n Program(programPath, state) {\n const currentFilePath = path.resolve(\n state.filename || state.file.opts.filename || ''\n );\n\n // Only apply polyfills to files that import gt-react-native or generaltranslation\n if (currentFilePath !== entryPointFilePath) {\n return;\n }\n\n const resolvedLocales = resolveLocales({\n locales,\n config,\n configFilePath,\n });\n\n // TODO: smart imports based on if the polyfill is required, do this as a wrapper around AppRegistry.registerComponent()\n const imports = [\n ...POLYFILLS.filter(\n (polyfill) => !excludePolyfills.includes(polyfill)\n ),\n ...resolvedLocales.flatMap((locale) =>\n LOCALE_POLYFILLS.map((localeData) => `${localeData}/${locale}`)\n ),\n ];\n\n const existingImports = new Set<string>();\n programPath.node.body.forEach((node) => {\n if (\n t.isImportDeclaration(node) &&\n typeof node.source.value === 'string' &&\n imports.includes(node.source.value)\n ) {\n existingImports.add(node.source.value);\n }\n });\n\n const importsToAdd = imports.filter((imp) => !existingImports.has(imp));\n\n if (importsToAdd.length > 0) {\n const newImports = importsToAdd.map((importPath) =>\n t.importDeclaration([], t.stringLiteral(importPath))\n );\n\n programPath.node.body.unshift(...newImports);\n }\n },\n },\n };\n}\n"],"mappings":";;;;;;;AAKA,SAAgB,OACd,OACA,EACE,SACA,QACA,gBACA,qBAAqB,KAAK,QAAQ,QAAQ,KAAK,EAAE,OAAO,UAAU,EAClE,mBAAmB,EAAE,IAEZ;CACX,MAAM,EAAE,OAAO,MAAM;AAErB,QAAO;EACL,MAAM;EACN,SAAS,EACP,QAAQ,aAAa,OAAO;AAM1B,OALwB,KAAK,QAC3B,MAAM,YAAY,MAAM,KAAK,KAAK,YAAY,GAI7B,KAAK,mBACtB;GAGF,MAAM,kBAAkBA,wCAAAA,eAAe;IACrC;IACA;IACA;IACD,CAAC;GAGF,MAAM,UAAU,CACd,GAAGC,yBAAAA,UAAU,QACV,aAAa,CAAC,iBAAiB,SAAS,SAAS,CACnD,EACD,GAAG,gBAAgB,SAAS,WAC1BC,yBAAAA,iBAAiB,KAAK,eAAe,GAAG,WAAW,GAAG,SAAS,CAChE,CACF;GAED,MAAM,kCAAkB,IAAI,KAAa;AACzC,eAAY,KAAK,KAAK,SAAS,SAAS;AACtC,QACE,EAAE,oBAAoB,KAAK,IAC3B,OAAO,KAAK,OAAO,UAAU,YAC7B,QAAQ,SAAS,KAAK,OAAO,MAAM,CAEnC,iBAAgB,IAAI,KAAK,OAAO,MAAM;KAExC;GAEF,MAAM,eAAe,QAAQ,QAAQ,QAAQ,CAAC,gBAAgB,IAAI,IAAI,CAAC;AAEvE,OAAI,aAAa,SAAS,GAAG;IAC3B,MAAM,aAAa,aAAa,KAAK,eACnC,EAAE,kBAAkB,EAAE,EAAE,EAAE,cAAc,WAAW,CAAC,CACrD;AAED,gBAAY,KAAK,KAAK,QAAQ,GAAG,WAAW;;KAGjD;EACF"}
@@ -1,6 +1,3 @@
1
- Object.defineProperties(exports, {
2
- __esModule: { value: true },
3
- [Symbol.toStringTag]: { value: "Module" }
4
- });
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
5
2
  const require_plugin_dir_index = require("./plugin-dir/index.js");
6
- exports.default = require_plugin_dir_index.default;
3
+ exports.plugin = require_plugin_dir_index.plugin;
@@ -10,34 +10,25 @@ let react = require("react");
10
10
  let react_jsx_runtime = require("react/jsx-runtime");
11
11
  //#region src/provider/GTProvider.tsx
12
12
  function GTProvider(props) {
13
- const { loadingFallback, ...providerProps } = props;
14
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Suspense, {
15
- fallback: loadingFallback ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DefaultLoadingFallback, {}),
16
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LoadableGTProvider, { ...providerProps })
17
- });
13
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LoadableGTProvider, { ...props });
18
14
  }
19
15
  /**
20
16
  * This wrapper takes the place of a loader that would be present in
21
17
  * SSR style applications.
22
18
  */
23
19
  function LoadableGTProvider(props) {
24
- const { locale, localeStoreKey, region, regionStoreKey, enableI18n, enableI18nStoreKey } = props;
20
+ const { fallback, ...providerProps } = props;
21
+ const renderedFallback = fallback ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DefaultLoadingFallback, {});
22
+ const { locale, region, enableI18n } = providerProps;
25
23
  const [nativeConditions, setNativeConditions] = (0, react.useState)(() => ({
26
- locale: require_utils_getLocale.getLocale({ localeStoreKey }),
27
- region: require_utils_getInitialNativeConditions.getInitialRegion({
28
- region,
29
- regionStoreKey
30
- }),
31
- enableI18n: require_utils_getInitialNativeConditions.getInitialEnableI18n({
32
- enableI18n,
33
- enableI18nStoreKey
34
- })
24
+ locale: require_utils_getLocale.getLocale(),
25
+ region: require_utils_getInitialNativeConditions.getInitialRegion({ region }),
26
+ enableI18n: require_utils_getInitialNativeConditions.getInitialEnableI18n({ enableI18n })
35
27
  }));
36
28
  const activeLocale = require_utils_resolveLocale.resolveLocale(locale ?? nativeConditions.locale);
37
29
  const activeRegion = region ?? nativeConditions.region;
38
30
  const activeEnableI18n = enableI18n ?? nativeConditions.enableI18n;
39
- const localeTranslations = (0, react.use)(require_provider_loadTranslations.loadTranslations(activeLocale));
40
- const translations = (0, react.useMemo)(() => ({ [activeLocale]: localeTranslations }), [activeLocale, localeTranslations]);
31
+ const fallbackTranslations = (0, react.useMemo)(() => ({ [activeLocale]: {} }), [activeLocale]);
41
32
  const reload = (0, react.useCallback)((state) => {
42
33
  setNativeConditions((previousState) => ({
43
34
  locale: locale === void 0 ? state.locale : previousState.locale,
@@ -49,13 +40,33 @@ function LoadableGTProvider(props) {
49
40
  locale,
50
41
  region
51
42
  ]);
43
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Suspense, {
44
+ fallback: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_provider_NativeGTProvider.NativeGTProvider, {
45
+ ...providerProps,
46
+ locale: activeLocale,
47
+ region: activeRegion,
48
+ enableI18n: activeEnableI18n,
49
+ translations: fallbackTranslations,
50
+ _reload: reload,
51
+ children: renderedFallback
52
+ }),
53
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LoadedGTProvider, {
54
+ ...providerProps,
55
+ locale: activeLocale,
56
+ region: activeRegion,
57
+ enableI18n: activeEnableI18n,
58
+ _reload: reload
59
+ })
60
+ });
61
+ }
62
+ function LoadedGTProvider(props) {
63
+ const activeLocale = require_utils_resolveLocale.resolveLocale(props.locale);
64
+ const localeTranslations = (0, react.use)(require_provider_loadTranslations.loadTranslations(activeLocale));
65
+ const translations = (0, react.useMemo)(() => ({ [activeLocale]: localeTranslations }), [activeLocale, localeTranslations]);
52
66
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_provider_NativeGTProvider.NativeGTProvider, {
53
67
  ...props,
54
68
  locale: activeLocale,
55
- region: activeRegion,
56
- enableI18n: activeEnableI18n,
57
- translations,
58
- _reload: reload
69
+ translations
59
70
  });
60
71
  }
61
72
  function DefaultLoadingFallback() {
@@ -1 +1 @@
1
- {"version":3,"file":"GTProvider.js","names":["Suspense","getLocale","getInitialRegion","getInitialEnableI18n","resolveLocale","loadTranslations","NativeGTProvider","View","ActivityIndicator","StyleSheet"],"sources":["../../../src/provider/GTProvider.tsx"],"sourcesContent":["import type { InternalGTProviderProps } from '@generaltranslation/react-core/components';\nimport { Suspense, use, useCallback, useMemo, useState } from 'react';\nimport type { ReactNode } from 'react';\nimport { ActivityIndicator, StyleSheet, View } from 'react-native';\nimport type { LocaleCandidates, Locale } from 'gt-i18n/internal/types';\nimport type {\n NativeConditionStoreParams,\n NativeConditionStoreState,\n} from '../condition-store/NativeConditionStore';\nimport { getLocale } from '../utils/getLocale';\nimport {\n getInitialEnableI18n,\n getInitialRegion,\n} from '../utils/getInitialNativeConditions';\nimport { resolveLocale } from '../utils/resolveLocale';\nimport { loadTranslations, type LocaleTranslations } from './loadTranslations';\nimport { NativeGTProvider } from './NativeGTProvider';\n\nexport type GTProviderProps = Omit<\n InternalGTProviderProps,\n 'conditionStore' | 'i18nStore' | 'translations'\n> &\n Omit<NativeConditionStoreParams, 'locale' | '_reload'> & {\n children?: ReactNode;\n locale?: LocaleCandidates;\n loadingFallback?: ReactNode;\n };\n\ntype LoadableGTProviderProps = Omit<GTProviderProps, 'loadingFallback'>;\ntype TranslationSnapshot = Record<Locale, LocaleTranslations>;\n\nexport function GTProvider(props: GTProviderProps) {\n const { loadingFallback, ...providerProps } = props;\n\n return (\n <Suspense fallback={loadingFallback ?? <DefaultLoadingFallback />}>\n <LoadableGTProvider {...providerProps} />\n </Suspense>\n );\n}\n\n/**\n * This wrapper takes the place of a loader that would be present in\n * SSR style applications.\n */\nfunction LoadableGTProvider(props: LoadableGTProviderProps) {\n const {\n locale,\n localeStoreKey,\n region,\n regionStoreKey,\n enableI18n,\n enableI18nStoreKey,\n } = props;\n // Keep native conditions in React state so condition-store writes trigger rerenders.\n const [nativeConditions, setNativeConditions] =\n useState<NativeConditionStoreState>(() => ({\n locale: getLocale({ localeStoreKey }),\n region: getInitialRegion({ region, regionStoreKey }),\n enableI18n: getInitialEnableI18n({ enableI18n, enableI18nStoreKey }),\n }));\n const activeLocale = resolveLocale(locale ?? nativeConditions.locale);\n const activeRegion = region ?? nativeConditions.region;\n const activeEnableI18n = enableI18n ?? nativeConditions.enableI18n;\n const localeTranslations = use(loadTranslations(activeLocale));\n const translations = useMemo<TranslationSnapshot>(\n () => ({ [activeLocale]: localeTranslations }),\n [activeLocale, localeTranslations]\n );\n const reload = useCallback(\n (state: NativeConditionStoreState) => {\n setNativeConditions((previousState) => ({\n locale: locale === undefined ? state.locale : previousState.locale,\n region: region === undefined ? state.region : previousState.region,\n enableI18n:\n enableI18n === undefined\n ? state.enableI18n\n : previousState.enableI18n,\n }));\n },\n [enableI18n, locale, region]\n );\n\n return (\n <NativeGTProvider\n {...props}\n locale={activeLocale}\n region={activeRegion}\n enableI18n={activeEnableI18n}\n translations={translations}\n _reload={reload}\n />\n );\n}\n\nfunction DefaultLoadingFallback() {\n return (\n <View style={styles.loadingContainer}>\n <ActivityIndicator />\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n loadingContainer: {\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n },\n});\n"],"mappings":";;;;;;;;;;;AA+BA,SAAgB,WAAW,OAAwB;CACjD,MAAM,EAAE,iBAAiB,GAAG,kBAAkB;AAE9C,QACE,iBAAA,GAAA,kBAAA,KAACA,MAAAA,UAAD;EAAU,UAAU,mBAAmB,iBAAA,GAAA,kBAAA,KAAC,wBAAD,EAA0B,CAAA;YAC/D,iBAAA,GAAA,kBAAA,KAAC,oBAAD,EAAoB,GAAI,eAAiB,CAAA;EAChC,CAAA;;;;;;AAQf,SAAS,mBAAmB,OAAgC;CAC1D,MAAM,EACJ,QACA,gBACA,QACA,gBACA,YACA,uBACE;CAEJ,MAAM,CAAC,kBAAkB,wBAAA,GAAA,MAAA,iBACoB;EACzC,QAAQC,wBAAAA,UAAU,EAAE,gBAAgB,CAAC;EACrC,QAAQC,yCAAAA,iBAAiB;GAAE;GAAQ;GAAgB,CAAC;EACpD,YAAYC,yCAAAA,qBAAqB;GAAE;GAAY;GAAoB,CAAC;EACrE,EAAE;CACL,MAAM,eAAeC,4BAAAA,cAAc,UAAU,iBAAiB,OAAO;CACrE,MAAM,eAAe,UAAU,iBAAiB;CAChD,MAAM,mBAAmB,cAAc,iBAAiB;CACxD,MAAM,sBAAA,GAAA,MAAA,KAAyBC,kCAAAA,iBAAiB,aAAa,CAAC;CAC9D,MAAM,gBAAA,GAAA,MAAA,gBACG,GAAG,eAAe,oBAAoB,GAC7C,CAAC,cAAc,mBAAmB,CACnC;CACD,MAAM,UAAA,GAAA,MAAA,cACH,UAAqC;AACpC,uBAAqB,mBAAmB;GACtC,QAAQ,WAAW,KAAA,IAAY,MAAM,SAAS,cAAc;GAC5D,QAAQ,WAAW,KAAA,IAAY,MAAM,SAAS,cAAc;GAC5D,YACE,eAAe,KAAA,IACX,MAAM,aACN,cAAc;GACrB,EAAE;IAEL;EAAC;EAAY;EAAQ;EAAO,CAC7B;AAED,QACE,iBAAA,GAAA,kBAAA,KAACC,kCAAAA,kBAAD;EACE,GAAI;EACJ,QAAQ;EACR,QAAQ;EACR,YAAY;EACE;EACd,SAAS;EACT,CAAA;;AAIN,SAAS,yBAAyB;AAChC,QACE,iBAAA,GAAA,kBAAA,KAACC,aAAAA,MAAD;EAAM,OAAO,OAAO;YAClB,iBAAA,GAAA,kBAAA,KAACC,aAAAA,mBAAD,EAAqB,CAAA;EAChB,CAAA;;AAIX,MAAM,SAASC,aAAAA,WAAW,OAAO,EAC/B,kBAAkB;CAChB,MAAM;CACN,YAAY;CACZ,gBAAgB;CACjB,EACF,CAAC"}
1
+ {"version":3,"file":"GTProvider.js","names":["getLocale","getInitialRegion","getInitialEnableI18n","resolveLocale","Suspense","NativeGTProvider","loadTranslations","View","ActivityIndicator","StyleSheet"],"sources":["../../../src/provider/GTProvider.tsx"],"sourcesContent":["import type { InternalGTProviderProps } from '@generaltranslation/react-core/components';\nimport { Suspense, use, useCallback, useMemo, useState } from 'react';\nimport type { ReactNode } from 'react';\nimport { ActivityIndicator, StyleSheet, View } from 'react-native';\nimport type { LocaleCandidates, Locale } from 'gt-i18n/internal/types';\nimport type {\n NativeConditionStoreParams,\n NativeConditionStoreState,\n} from '../condition-store/NativeConditionStore';\nimport { getLocale } from '../utils/getLocale';\nimport {\n getInitialEnableI18n,\n getInitialRegion,\n} from '../utils/getInitialNativeConditions';\nimport { resolveLocale } from '../utils/resolveLocale';\nimport { loadTranslations, type LocaleTranslations } from './loadTranslations';\nimport {\n NativeGTProvider,\n type NativeGTProviderProps,\n} from './NativeGTProvider';\n\nexport type GTProviderProps = Omit<\n InternalGTProviderProps,\n 'conditionStore' | 'i18nStore' | 'translations'\n> &\n Omit<NativeConditionStoreParams, 'locale' | '_reload'> & {\n children?: ReactNode;\n locale?: LocaleCandidates;\n fallback?: ReactNode;\n };\n\ntype LoadedGTProviderProps = Omit<NativeGTProviderProps, 'translations'>;\ntype TranslationSnapshot = Record<Locale, LocaleTranslations>;\n\nexport function GTProvider(props: GTProviderProps) {\n return <LoadableGTProvider {...props} />;\n}\n\n/**\n * This wrapper takes the place of a loader that would be present in\n * SSR style applications.\n */\nfunction LoadableGTProvider(props: GTProviderProps) {\n const { fallback, ...providerProps } = props;\n const renderedFallback = fallback ?? <DefaultLoadingFallback />;\n const { locale, region, enableI18n } = providerProps;\n // Keep native conditions in React state so condition-store writes trigger rerenders.\n const [nativeConditions, setNativeConditions] =\n useState<NativeConditionStoreState>(() => ({\n locale: getLocale(),\n region: getInitialRegion({ region }),\n enableI18n: getInitialEnableI18n({ enableI18n }),\n }));\n const activeLocale = resolveLocale(locale ?? nativeConditions.locale);\n const activeRegion = region ?? nativeConditions.region;\n const activeEnableI18n = enableI18n ?? nativeConditions.enableI18n;\n const fallbackTranslations = useMemo<TranslationSnapshot>(\n () => ({ [activeLocale]: {} }),\n [activeLocale]\n );\n const reload = useCallback(\n (state: NativeConditionStoreState) => {\n setNativeConditions((previousState) => ({\n locale: locale === undefined ? state.locale : previousState.locale,\n region: region === undefined ? state.region : previousState.region,\n enableI18n:\n enableI18n === undefined\n ? state.enableI18n\n : previousState.enableI18n,\n }));\n },\n [enableI18n, locale, region]\n );\n\n return (\n <Suspense\n fallback={\n <NativeGTProvider\n {...providerProps}\n locale={activeLocale}\n region={activeRegion}\n enableI18n={activeEnableI18n}\n translations={fallbackTranslations}\n _reload={reload}\n >\n {renderedFallback}\n </NativeGTProvider>\n }\n >\n <LoadedGTProvider\n {...providerProps}\n locale={activeLocale}\n region={activeRegion}\n enableI18n={activeEnableI18n}\n _reload={reload}\n />\n </Suspense>\n );\n}\n\nfunction LoadedGTProvider(props: LoadedGTProviderProps) {\n const activeLocale = resolveLocale(props.locale);\n const localeTranslations = use(loadTranslations(activeLocale));\n const translations = useMemo<TranslationSnapshot>(\n () => ({ [activeLocale]: localeTranslations }),\n [activeLocale, localeTranslations]\n );\n\n return (\n <NativeGTProvider\n {...props}\n locale={activeLocale}\n translations={translations}\n />\n );\n}\n\nfunction DefaultLoadingFallback() {\n return (\n <View style={styles.loadingContainer}>\n <ActivityIndicator />\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n loadingContainer: {\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n },\n});\n"],"mappings":";;;;;;;;;;;AAkCA,SAAgB,WAAW,OAAwB;AACjD,QAAO,iBAAA,GAAA,kBAAA,KAAC,oBAAD,EAAoB,GAAI,OAAS,CAAA;;;;;;AAO1C,SAAS,mBAAmB,OAAwB;CAClD,MAAM,EAAE,UAAU,GAAG,kBAAkB;CACvC,MAAM,mBAAmB,YAAY,iBAAA,GAAA,kBAAA,KAAC,wBAAD,EAA0B,CAAA;CAC/D,MAAM,EAAE,QAAQ,QAAQ,eAAe;CAEvC,MAAM,CAAC,kBAAkB,wBAAA,GAAA,MAAA,iBACoB;EACzC,QAAQA,wBAAAA,WAAW;EACnB,QAAQC,yCAAAA,iBAAiB,EAAE,QAAQ,CAAC;EACpC,YAAYC,yCAAAA,qBAAqB,EAAE,YAAY,CAAC;EACjD,EAAE;CACL,MAAM,eAAeC,4BAAAA,cAAc,UAAU,iBAAiB,OAAO;CACrE,MAAM,eAAe,UAAU,iBAAiB;CAChD,MAAM,mBAAmB,cAAc,iBAAiB;CACxD,MAAM,wBAAA,GAAA,MAAA,gBACG,GAAG,eAAe,EAAE,EAAE,GAC7B,CAAC,aAAa,CACf;CACD,MAAM,UAAA,GAAA,MAAA,cACH,UAAqC;AACpC,uBAAqB,mBAAmB;GACtC,QAAQ,WAAW,KAAA,IAAY,MAAM,SAAS,cAAc;GAC5D,QAAQ,WAAW,KAAA,IAAY,MAAM,SAAS,cAAc;GAC5D,YACE,eAAe,KAAA,IACX,MAAM,aACN,cAAc;GACrB,EAAE;IAEL;EAAC;EAAY;EAAQ;EAAO,CAC7B;AAED,QACE,iBAAA,GAAA,kBAAA,KAACC,MAAAA,UAAD;EACE,UACE,iBAAA,GAAA,kBAAA,KAACC,kCAAAA,kBAAD;GACE,GAAI;GACJ,QAAQ;GACR,QAAQ;GACR,YAAY;GACZ,cAAc;GACd,SAAS;aAER;GACgB,CAAA;YAGrB,iBAAA,GAAA,kBAAA,KAAC,kBAAD;GACE,GAAI;GACJ,QAAQ;GACR,QAAQ;GACR,YAAY;GACZ,SAAS;GACT,CAAA;EACO,CAAA;;AAIf,SAAS,iBAAiB,OAA8B;CACtD,MAAM,eAAeF,4BAAAA,cAAc,MAAM,OAAO;CAChD,MAAM,sBAAA,GAAA,MAAA,KAAyBG,kCAAAA,iBAAiB,aAAa,CAAC;CAC9D,MAAM,gBAAA,GAAA,MAAA,gBACG,GAAG,eAAe,oBAAoB,GAC7C,CAAC,cAAc,mBAAmB,CACnC;AAED,QACE,iBAAA,GAAA,kBAAA,KAACD,kCAAAA,kBAAD;EACE,GAAI;EACJ,QAAQ;EACM;EACd,CAAA;;AAIN,SAAS,yBAAyB;AAChC,QACE,iBAAA,GAAA,kBAAA,KAACE,aAAAA,MAAD;EAAM,OAAO,OAAO;YAClB,iBAAA,GAAA,kBAAA,KAACC,aAAAA,mBAAD,EAAqB,CAAA;EAChB,CAAA;;AAIX,MAAM,SAASC,aAAAA,WAAW,OAAO,EAC/B,kBAAkB;CAChB,MAAM;CACN,YAAY;CACZ,gBAAgB;CACjB,EACF,CAAC"}
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("../_virtual/_rolldown/runtime.js");
3
3
  const require_condition_store_NativeConditionStore = require("../condition-store/NativeConditionStore.js");
4
- let react = require("react");
5
4
  let _generaltranslation_react_core_components = require("@generaltranslation/react-core/components");
5
+ let react = require("react");
6
6
  let react_jsx_runtime = require("react/jsx-runtime");
7
7
  //#region src/provider/NativeGTProvider.tsx
8
8
  function NativeGTProvider(props) {
@@ -12,9 +12,6 @@ function NativeGTProvider(props) {
12
12
  props.locale,
13
13
  props.region,
14
14
  props.enableI18n,
15
- props.localeStoreKey,
16
- props.regionStoreKey,
17
- props.enableI18nStoreKey,
18
15
  props._reload
19
16
  ]);
20
17
  const i18nStoreRef = (0, react.useRef)(null);
@@ -1 +1 @@
1
- {"version":3,"file":"NativeGTProvider.js","names":["NativeConditionStore","I18nStore","InternalGTProvider"],"sources":["../../../src/provider/NativeGTProvider.tsx"],"sourcesContent":["import {\n I18nStore,\n InternalGTProvider,\n type InternalGTProviderProps,\n} from '@generaltranslation/react-core/components';\nimport { useMemo, useRef } from 'react';\nimport type { LocaleCandidates } from 'gt-i18n/internal/types';\nimport type { NativeConditionStoreParams } from '../condition-store/NativeConditionStore';\nimport { NativeConditionStore } from '../condition-store/NativeConditionStore';\n\nexport type NativeGTProviderProps = Omit<\n InternalGTProviderProps,\n 'conditionStore' | 'i18nStore'\n> &\n Omit<NativeConditionStoreParams, 'locale'> & {\n locale: LocaleCandidates;\n };\n\nexport function NativeGTProvider(props: NativeGTProviderProps) {\n const conditionStore = useMemo(() => {\n return new NativeConditionStore(props);\n }, [\n props.locale,\n props.region,\n props.enableI18n,\n props.localeStoreKey,\n props.regionStoreKey,\n props.enableI18nStoreKey,\n props._reload,\n ]);\n\n const i18nStoreRef = useRef<I18nStore | null>(null);\n if (i18nStoreRef.current == null) {\n i18nStoreRef.current = new I18nStore();\n }\n\n return (\n <InternalGTProvider\n {...props}\n conditionStore={conditionStore}\n i18nStore={i18nStoreRef.current}\n />\n );\n}\n"],"mappings":";;;;;;;AAkBA,SAAgB,iBAAiB,OAA8B;CAC7D,MAAM,kBAAA,GAAA,MAAA,eAA+B;AACnC,SAAO,IAAIA,6CAAAA,qBAAqB,MAAM;IACrC;EACD,MAAM;EACN,MAAM;EACN,MAAM;EACN,MAAM;EACN,MAAM;EACN,MAAM;EACN,MAAM;EACP,CAAC;CAEF,MAAM,gBAAA,GAAA,MAAA,QAAwC,KAAK;AACnD,KAAI,aAAa,WAAW,KAC1B,cAAa,UAAU,IAAIC,0CAAAA,WAAW;AAGxC,QACE,iBAAA,GAAA,kBAAA,KAACC,0CAAAA,oBAAD;EACE,GAAI;EACY;EAChB,WAAW,aAAa;EACxB,CAAA"}
1
+ {"version":3,"file":"NativeGTProvider.js","names":["NativeConditionStore","I18nStore","InternalGTProvider"],"sources":["../../../src/provider/NativeGTProvider.tsx"],"sourcesContent":["import {\n I18nStore,\n InternalGTProvider,\n type InternalGTProviderProps,\n} from '@generaltranslation/react-core/components';\nimport { useMemo, useRef } from 'react';\nimport type { LocaleCandidates } from 'gt-i18n/internal/types';\nimport type { NativeConditionStoreParams } from '../condition-store/NativeConditionStore';\nimport { NativeConditionStore } from '../condition-store/NativeConditionStore';\n\nexport type NativeGTProviderProps = Omit<\n InternalGTProviderProps,\n 'conditionStore' | 'i18nStore'\n> &\n Omit<NativeConditionStoreParams, 'locale'> & {\n locale: LocaleCandidates;\n };\n\nexport function NativeGTProvider(props: NativeGTProviderProps) {\n const conditionStore = useMemo(() => {\n return new NativeConditionStore(props);\n }, [props.locale, props.region, props.enableI18n, props._reload]);\n\n const i18nStoreRef = useRef<I18nStore | null>(null);\n if (i18nStoreRef.current == null) {\n i18nStoreRef.current = new I18nStore();\n }\n\n return (\n <InternalGTProvider\n {...props}\n conditionStore={conditionStore}\n i18nStore={i18nStoreRef.current}\n />\n );\n}\n"],"mappings":";;;;;;;AAkBA,SAAgB,iBAAiB,OAA8B;CAC7D,MAAM,kBAAA,GAAA,MAAA,eAA+B;AACnC,SAAO,IAAIA,6CAAAA,qBAAqB,MAAM;IACrC;EAAC,MAAM;EAAQ,MAAM;EAAQ,MAAM;EAAY,MAAM;EAAQ,CAAC;CAEjE,MAAM,gBAAA,GAAA,MAAA,QAAwC,KAAK;AACnD,KAAI,aAAa,WAAW,KAC1B,cAAa,UAAU,IAAIC,0CAAAA,WAAW;AAGxC,QACE,iBAAA,GAAA,kBAAA,KAACC,0CAAAA,oBAAD;EACE,GAAI;EACY;EAChB,WAAW,aAAa;EACxB,CAAA"}
@@ -1,14 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("../_virtual/_rolldown/runtime.js");
3
3
  let _generaltranslation_react_core_pure = require("@generaltranslation/react-core/pure");
4
- let gt_i18n_internal = require("gt-i18n/internal");
5
- //#region src/setup/initializeGT.ts
6
- function initializeGT(config) {
7
- (0, gt_i18n_internal.setupGTServicesEnabled)(config);
8
- (0, _generaltranslation_react_core_pure.initializeI18nConfig)(config, "server-render");
9
- (0, _generaltranslation_react_core_pure.setReactI18nCache)(new _generaltranslation_react_core_pure.ReactI18nCache(config));
10
- }
11
- //#endregion
12
- exports.initializeGT = initializeGT;
13
-
14
- //# sourceMappingURL=initializeGT.js.map
4
+ Object.defineProperty(exports, "initializeGT", {
5
+ enumerable: true,
6
+ get: function() {
7
+ return _generaltranslation_react_core_pure.internalInitializeGTSRA;
8
+ }
9
+ });
@@ -3,11 +3,11 @@ require("../_virtual/_rolldown/runtime.js");
3
3
  const require_utils_nativeStore = require("./nativeStore.js");
4
4
  let _generaltranslation_react_core_pure = require("@generaltranslation/react-core/pure");
5
5
  //#region src/utils/getInitialNativeConditions.ts
6
- function getInitialRegion({ region, regionStoreKey = _generaltranslation_react_core_pure.defaultRegionCookieName }) {
6
+ function getInitialRegion({ region, regionStoreKey = (0, _generaltranslation_react_core_pure.getI18nConfig)().getRegionCookieName() }) {
7
7
  if (region !== void 0) return region;
8
8
  return require_utils_nativeStore.nativeStoreGet(regionStoreKey) || void 0;
9
9
  }
10
- function getInitialEnableI18n({ enableI18n, enableI18nStoreKey = _generaltranslation_react_core_pure.defaultEnableI18nCookieName }) {
10
+ function getInitialEnableI18n({ enableI18n, enableI18nStoreKey = (0, _generaltranslation_react_core_pure.getI18nConfig)().getEnableI18nCookieName() }) {
11
11
  if (enableI18n !== void 0) return enableI18n;
12
12
  const storedEnableI18n = require_utils_nativeStore.nativeStoreGet(enableI18nStoreKey);
13
13
  if (storedEnableI18n === null) return true;
@@ -1 +1 @@
1
- {"version":3,"file":"getInitialNativeConditions.js","names":["defaultRegionStoreKey","nativeStoreGet","defaultEnableI18nStoreKey"],"sources":["../../../src/utils/getInitialNativeConditions.ts"],"sourcesContent":["import type { WritableConditionStoreParams } from 'gt-i18n/internal/types';\nimport {\n defaultEnableI18nCookieName as defaultEnableI18nStoreKey,\n defaultRegionCookieName as defaultRegionStoreKey,\n} from '@generaltranslation/react-core/pure';\nimport { nativeStoreGet } from './nativeStore';\n\ntype InitialRegionParams = Pick<WritableConditionStoreParams, 'region'> & {\n regionStoreKey?: string;\n};\n\ntype InitialEnableI18nParams = Pick<\n WritableConditionStoreParams,\n 'enableI18n'\n> & {\n enableI18nStoreKey?: string;\n};\n\nexport function getInitialRegion({\n region,\n regionStoreKey = defaultRegionStoreKey,\n}: InitialRegionParams): string | undefined {\n if (region !== undefined) return region;\n return nativeStoreGet(regionStoreKey) || undefined;\n}\n\nexport function getInitialEnableI18n({\n enableI18n,\n enableI18nStoreKey = defaultEnableI18nStoreKey,\n}: InitialEnableI18nParams): boolean {\n if (enableI18n !== undefined) return enableI18n;\n const storedEnableI18n = nativeStoreGet(enableI18nStoreKey);\n if (storedEnableI18n === null) return true;\n return storedEnableI18n === 'true';\n}\n"],"mappings":";;;;;AAkBA,SAAgB,iBAAiB,EAC/B,QACA,iBAAiBA,oCAAAA,2BACyB;AAC1C,KAAI,WAAW,KAAA,EAAW,QAAO;AACjC,QAAOC,0BAAAA,eAAe,eAAe,IAAI,KAAA;;AAG3C,SAAgB,qBAAqB,EACnC,YACA,qBAAqBC,oCAAAA,+BACc;AACnC,KAAI,eAAe,KAAA,EAAW,QAAO;CACrC,MAAM,mBAAmBD,0BAAAA,eAAe,mBAAmB;AAC3D,KAAI,qBAAqB,KAAM,QAAO;AACtC,QAAO,qBAAqB"}
1
+ {"version":3,"file":"getInitialNativeConditions.js","names":["nativeStoreGet"],"sources":["../../../src/utils/getInitialNativeConditions.ts"],"sourcesContent":["import type { WritableConditionStoreParams } from 'gt-i18n/internal/types';\nimport { getI18nConfig } from '@generaltranslation/react-core/pure';\nimport { nativeStoreGet } from './nativeStore';\n\ntype InitialRegionParams = Pick<WritableConditionStoreParams, 'region'> & {\n regionStoreKey?: string;\n};\n\ntype InitialEnableI18nParams = Pick<\n WritableConditionStoreParams,\n 'enableI18n'\n> & {\n enableI18nStoreKey?: string;\n};\n\nexport function getInitialRegion({\n region,\n regionStoreKey = getI18nConfig().getRegionCookieName(),\n}: InitialRegionParams): string | undefined {\n if (region !== undefined) return region;\n return nativeStoreGet(regionStoreKey) || undefined;\n}\n\nexport function getInitialEnableI18n({\n enableI18n,\n enableI18nStoreKey = getI18nConfig().getEnableI18nCookieName(),\n}: InitialEnableI18nParams): boolean {\n if (enableI18n !== undefined) return enableI18n;\n const storedEnableI18n = nativeStoreGet(enableI18nStoreKey);\n if (storedEnableI18n === null) return true;\n return storedEnableI18n === 'true';\n}\n"],"mappings":";;;;;AAeA,SAAgB,iBAAiB,EAC/B,QACA,kBAAA,GAAA,oCAAA,gBAAgC,CAAC,qBAAqB,IACZ;AAC1C,KAAI,WAAW,KAAA,EAAW,QAAO;AACjC,QAAOA,0BAAAA,eAAe,eAAe,IAAI,KAAA;;AAG3C,SAAgB,qBAAqB,EACnC,YACA,sBAAA,GAAA,oCAAA,gBAAoC,CAAC,yBAAyB,IAC3B;AACnC,KAAI,eAAe,KAAA,EAAW,QAAO;CACrC,MAAM,mBAAmBA,0BAAAA,eAAe,mBAAmB;AAC3D,KAAI,qBAAqB,KAAM,QAAO;AACtC,QAAO,qBAAqB"}
@@ -8,7 +8,7 @@ let _generaltranslation_react_core_pure = require("@generaltranslation/react-cor
8
8
  /**
9
9
  * @internal
10
10
  */
11
- function getLocale({ localeStoreKey = _generaltranslation_react_core_pure.defaultLocaleCookieName } = {}) {
11
+ function getLocale({ localeStoreKey = (0, _generaltranslation_react_core_pure.getI18nConfig)().getLocaleCookieName() } = {}) {
12
12
  const candidates = [];
13
13
  pushLocaleCandidates(candidates, require_utils_nativeStore.nativeStoreGet(localeStoreKey));
14
14
  candidates.push(...require_utils_getNativeLocales.getNativeLocales());
@@ -1 +1 @@
1
- {"version":3,"file":"getLocale.js","names":["defaultLocaleStoreKey","nativeStoreGet","getNativeLocales","resolveLocale"],"sources":["../../../src/utils/getLocale.ts"],"sourcesContent":["import type { LocaleCandidates } from 'gt-i18n/internal/types';\nimport { defaultLocaleCookieName as defaultLocaleStoreKey } from '@generaltranslation/react-core/pure';\nimport { getNativeLocales } from './getNativeLocales';\nimport { nativeStoreGet } from './nativeStore';\nimport { resolveLocale } from './resolveLocale';\n\nexport type GetLocaleParams = {\n localeStoreKey?: string;\n};\n\n/**\n * @internal\n */\nexport function getLocale({\n localeStoreKey = defaultLocaleStoreKey,\n}: GetLocaleParams = {}): string {\n const candidates: string[] = [];\n pushLocaleCandidates(candidates, nativeStoreGet(localeStoreKey));\n candidates.push(...getNativeLocales());\n\n return resolveLocale(candidates);\n}\n\nfunction pushLocaleCandidates(\n target: string[],\n locale: LocaleCandidates | null\n) {\n if (!locale) return;\n if (Array.isArray(locale)) {\n target.push(...locale);\n return;\n }\n target.push(locale);\n}\n"],"mappings":";;;;;;;;;;AAaA,SAAgB,UAAU,EACxB,iBAAiBA,oCAAAA,4BACE,EAAE,EAAU;CAC/B,MAAM,aAAuB,EAAE;AAC/B,sBAAqB,YAAYC,0BAAAA,eAAe,eAAe,CAAC;AAChE,YAAW,KAAK,GAAGC,+BAAAA,kBAAkB,CAAC;AAEtC,QAAOC,4BAAAA,cAAc,WAAW;;AAGlC,SAAS,qBACP,QACA,QACA;AACA,KAAI,CAAC,OAAQ;AACb,KAAI,MAAM,QAAQ,OAAO,EAAE;AACzB,SAAO,KAAK,GAAG,OAAO;AACtB;;AAEF,QAAO,KAAK,OAAO"}
1
+ {"version":3,"file":"getLocale.js","names":["nativeStoreGet","getNativeLocales","resolveLocale"],"sources":["../../../src/utils/getLocale.ts"],"sourcesContent":["import type { LocaleCandidates } from 'gt-i18n/internal/types';\nimport { getI18nConfig } from '@generaltranslation/react-core/pure';\nimport { getNativeLocales } from './getNativeLocales';\nimport { nativeStoreGet } from './nativeStore';\nimport { resolveLocale } from './resolveLocale';\n\nexport type GetLocaleParams = {\n localeStoreKey?: string;\n};\n\n/**\n * @internal\n */\nexport function getLocale({\n localeStoreKey = getI18nConfig().getLocaleCookieName(),\n}: GetLocaleParams = {}): string {\n const candidates: string[] = [];\n pushLocaleCandidates(candidates, nativeStoreGet(localeStoreKey));\n candidates.push(...getNativeLocales());\n\n return resolveLocale(candidates);\n}\n\nfunction pushLocaleCandidates(\n target: string[],\n locale: LocaleCandidates | null\n) {\n if (!locale) return;\n if (Array.isArray(locale)) {\n target.push(...locale);\n return;\n }\n target.push(locale);\n}\n"],"mappings":";;;;;;;;;;AAaA,SAAgB,UAAU,EACxB,kBAAA,GAAA,oCAAA,gBAAgC,CAAC,qBAAqB,KACnC,EAAE,EAAU;CAC/B,MAAM,aAAuB,EAAE;AAC/B,sBAAqB,YAAYA,0BAAAA,eAAe,eAAe,CAAC;AAChE,YAAW,KAAK,GAAGC,+BAAAA,kBAAkB,CAAC;AAEtC,QAAOC,4BAAAA,cAAc,WAAW;;AAGlC,SAAS,qBACP,QACA,QACA;AACA,KAAI,CAAC,OAAQ;AACb,KAAI,MAAM,QAAQ,OAAO,EAAE;AACzB,SAAO,KAAK,GAAG,OAAO;AACtB;;AAEF,QAAO,KAAK,OAAO"}
@@ -14,7 +14,7 @@ let react_native = require("react-native");
14
14
  function getNativeLocales() {
15
15
  try {
16
16
  if (react_native.Platform.OS === "web") return getWebLocales();
17
- return require_NativeGtReactNative.default.getNativeLocales() || [];
17
+ return require_NativeGtReactNative.GtReactNative.getNativeLocales() || [];
18
18
  } catch {
19
19
  return [];
20
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"getNativeLocales.js","names":["Platform","GtReactNative"],"sources":["../../../src/utils/getNativeLocales.ts"],"sourcesContent":["import { Platform } from 'react-native';\nimport GtReactNative from '../NativeGtReactNative';\n\n/**\n * Get native device locales in preference order\n * Returns an empty array if detection fails or is not supported\n *\n * iOS: Returns current locale first, followed by preferred languages\n * Android: Returns user's preferred language list (LocaleList on API 24+, single locale on older versions)\n * Web: Returns browser language preferences from navigator\n */\nexport function getNativeLocales(): string[] {\n try {\n // Web platform - use browser locale detection\n if (Platform.OS === 'web') {\n return getWebLocales();\n }\n\n // Try to get locales from native module\n return GtReactNative.getNativeLocales() || [];\n } catch {\n // Return empty array on any error (native module not available, etc.)\n return [];\n }\n}\n\n/**\n * Get browser locales for web platform\n */\nfunction getWebLocales(): string[] {\n try {\n if (typeof navigator === 'undefined') {\n return [];\n }\n\n const locales: string[] = [];\n\n // Use navigator.languages if available (most browsers)\n if (navigator.languages && Array.isArray(navigator.languages)) {\n locales.push(...navigator.languages);\n } else if (navigator.language) {\n // Fallback to single language\n locales.push(navigator.language);\n } else {\n // IE fallback\n const legacyNavigator = navigator as Navigator & {\n userLanguage?: string;\n };\n if (legacyNavigator.userLanguage) {\n locales.push(legacyNavigator.userLanguage);\n }\n }\n\n return locales;\n } catch {\n return [];\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAWA,SAAgB,mBAA6B;AAC3C,KAAI;AAEF,MAAIA,aAAAA,SAAS,OAAO,MAClB,QAAO,eAAe;AAIxB,SAAOC,4BAAAA,QAAc,kBAAkB,IAAI,EAAE;SACvC;AAEN,SAAO,EAAE;;;;;;AAOb,SAAS,gBAA0B;AACjC,KAAI;AACF,MAAI,OAAO,cAAc,YACvB,QAAO,EAAE;EAGX,MAAM,UAAoB,EAAE;AAG5B,MAAI,UAAU,aAAa,MAAM,QAAQ,UAAU,UAAU,CAC3D,SAAQ,KAAK,GAAG,UAAU,UAAU;WAC3B,UAAU,SAEnB,SAAQ,KAAK,UAAU,SAAS;OAC3B;GAEL,MAAM,kBAAkB;AAGxB,OAAI,gBAAgB,aAClB,SAAQ,KAAK,gBAAgB,aAAa;;AAI9C,SAAO;SACD;AACN,SAAO,EAAE"}
1
+ {"version":3,"file":"getNativeLocales.js","names":["Platform","GtReactNative"],"sources":["../../../src/utils/getNativeLocales.ts"],"sourcesContent":["import { Platform } from 'react-native';\nimport { GtReactNative } from '../NativeGtReactNative';\n\n/**\n * Get native device locales in preference order\n * Returns an empty array if detection fails or is not supported\n *\n * iOS: Returns current locale first, followed by preferred languages\n * Android: Returns user's preferred language list (LocaleList on API 24+, single locale on older versions)\n * Web: Returns browser language preferences from navigator\n */\nexport function getNativeLocales(): string[] {\n try {\n // Web platform - use browser locale detection\n if (Platform.OS === 'web') {\n return getWebLocales();\n }\n\n // Try to get locales from native module\n return GtReactNative.getNativeLocales() || [];\n } catch {\n // Return empty array on any error (native module not available, etc.)\n return [];\n }\n}\n\n/**\n * Get browser locales for web platform\n */\nfunction getWebLocales(): string[] {\n try {\n if (typeof navigator === 'undefined') {\n return [];\n }\n\n const locales: string[] = [];\n\n // Use navigator.languages if available (most browsers)\n if (navigator.languages && Array.isArray(navigator.languages)) {\n locales.push(...navigator.languages);\n } else if (navigator.language) {\n // Fallback to single language\n locales.push(navigator.language);\n } else {\n // IE fallback\n const legacyNavigator = navigator as Navigator & {\n userLanguage?: string;\n };\n if (legacyNavigator.userLanguage) {\n locales.push(legacyNavigator.userLanguage);\n }\n }\n\n return locales;\n } catch {\n return [];\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAWA,SAAgB,mBAA6B;AAC3C,KAAI;AAEF,MAAIA,aAAAA,SAAS,OAAO,MAClB,QAAO,eAAe;AAIxB,SAAOC,4BAAAA,cAAc,kBAAkB,IAAI,EAAE;SACvC;AAEN,SAAO,EAAE;;;;;;AAOb,SAAS,gBAA0B;AACjC,KAAI;AACF,MAAI,OAAO,cAAc,YACvB,QAAO,EAAE;EAGX,MAAM,UAAoB,EAAE;AAG5B,MAAI,UAAU,aAAa,MAAM,QAAQ,UAAU,UAAU,CAC3D,SAAQ,KAAK,GAAG,UAAU,UAAU;WAC3B,UAAU,SAEnB,SAAQ,KAAK,UAAU,SAAS;OAC3B;GAEL,MAAM,kBAAkB;AAGxB,OAAI,gBAAgB,aAClB,SAAQ,KAAK,gBAAgB,aAAa;;AAI9C,SAAO;SACD;AACN,SAAO,EAAE"}
@@ -11,12 +11,12 @@ let _generaltranslation_react_core_pure = require("@generaltranslation/react-cor
11
11
  * This reads persisted native storage directly, so it can temporarily be out of
12
12
  * sync with React state while a locale change is in progress.
13
13
  *
14
- * If GTProvider uses a custom localeStoreKey, pass that same value as the key.
14
+ * Defaults to the store key configured through initializeGT().
15
15
  *
16
16
  * @param key - The key to get the locale from
17
17
  * @returns The locale from the native store
18
18
  */
19
- function getLocaleFromNativeStore(key = _generaltranslation_react_core_pure.defaultLocaleCookieName) {
19
+ function getLocaleFromNativeStore(key = (0, _generaltranslation_react_core_pure.getI18nConfig)().getLocaleCookieName()) {
20
20
  return nativeStoreGet(key);
21
21
  }
22
22
  /**
@@ -32,7 +32,7 @@ function nativeStoreGet(key) {
32
32
  }
33
33
  return localStorage.getItem(key);
34
34
  }
35
- return require_NativeGtReactNative.default.nativeStoreGet(key);
35
+ return require_NativeGtReactNative.GtReactNative.nativeStoreGet(key);
36
36
  }
37
37
  /**
38
38
  * Set a value in the native store
@@ -48,7 +48,7 @@ function nativeStoreSet(key, value) {
48
48
  localStorage.setItem(key, value);
49
49
  return;
50
50
  }
51
- require_NativeGtReactNative.default.nativeStoreSet(key, value);
51
+ require_NativeGtReactNative.GtReactNative.nativeStoreSet(key, value);
52
52
  }
53
53
  //#endregion
54
54
  exports.getLocaleFromNativeStore = getLocaleFromNativeStore;
@@ -1 +1 @@
1
- {"version":3,"file":"nativeStore.js","names":["defaultLocaleStoreKey","Platform","ssrUnsupportedWarning","GtReactNative"],"sources":["../../../src/utils/nativeStore.ts"],"sourcesContent":["import { defaultLocaleCookieName as defaultLocaleStoreKey } from '@generaltranslation/react-core/pure';\nimport { Platform } from 'react-native';\nimport GtReactNative from '../NativeGtReactNative';\nimport { ssrUnsupportedWarning } from '../errors-dir/warnings';\n\n/**\n * Get the locale from the native store.\n *\n * This reads persisted native storage directly, so it can temporarily be out of\n * sync with React state while a locale change is in progress.\n *\n * If GTProvider uses a custom localeStoreKey, pass that same value as the key.\n *\n * @param key - The key to get the locale from\n * @returns The locale from the native store\n */\nexport function getLocaleFromNativeStore(\n key = defaultLocaleStoreKey\n): string | null {\n return nativeStoreGet(key);\n}\n\n/**\n * Get a value from the native store\n * @param key - The key to get the value for\n * @returns The value for the key\n */\nexport function nativeStoreGet(key: string): string | null {\n if (Platform.OS === 'web') {\n if (typeof localStorage === 'undefined') {\n // eslint-disable-next-line no-console\n console.warn(ssrUnsupportedWarning);\n return null;\n }\n return localStorage.getItem(key);\n }\n return GtReactNative.nativeStoreGet(key);\n}\n\n/**\n * Set a value in the native store\n * @param key - The key to set the value for\n * @param value - The value to set\n */\nexport function nativeStoreSet(key: string, value: string): void {\n if (Platform.OS === 'web') {\n if (typeof localStorage === 'undefined') {\n // eslint-disable-next-line no-console\n console.warn(ssrUnsupportedWarning);\n return;\n }\n localStorage.setItem(key, value);\n return;\n }\n GtReactNative.nativeStoreSet(key, value);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgBA,SAAgB,yBACd,MAAMA,oCAAAA,yBACS;AACf,QAAO,eAAe,IAAI;;;;;;;AAQ5B,SAAgB,eAAe,KAA4B;AACzD,KAAIC,aAAAA,SAAS,OAAO,OAAO;AACzB,MAAI,OAAO,iBAAiB,aAAa;AAEvC,WAAQ,KAAKC,4BAAAA,sBAAsB;AACnC,UAAO;;AAET,SAAO,aAAa,QAAQ,IAAI;;AAElC,QAAOC,4BAAAA,QAAc,eAAe,IAAI;;;;;;;AAQ1C,SAAgB,eAAe,KAAa,OAAqB;AAC/D,KAAIF,aAAAA,SAAS,OAAO,OAAO;AACzB,MAAI,OAAO,iBAAiB,aAAa;AAEvC,WAAQ,KAAKC,4BAAAA,sBAAsB;AACnC;;AAEF,eAAa,QAAQ,KAAK,MAAM;AAChC;;AAEF,6BAAA,QAAc,eAAe,KAAK,MAAM"}
1
+ {"version":3,"file":"nativeStore.js","names":["Platform","ssrUnsupportedWarning","GtReactNative"],"sources":["../../../src/utils/nativeStore.ts"],"sourcesContent":["import { Platform } from 'react-native';\nimport { getI18nConfig } from '@generaltranslation/react-core/pure';\nimport { GtReactNative } from '../NativeGtReactNative';\nimport { ssrUnsupportedWarning } from '../errors-dir/warnings';\n\n/**\n * Get the locale from the native store.\n *\n * This reads persisted native storage directly, so it can temporarily be out of\n * sync with React state while a locale change is in progress.\n *\n * Defaults to the store key configured through initializeGT().\n *\n * @param key - The key to get the locale from\n * @returns The locale from the native store\n */\nexport function getLocaleFromNativeStore(\n key = getI18nConfig().getLocaleCookieName()\n): string | null {\n return nativeStoreGet(key);\n}\n\n/**\n * Get a value from the native store\n * @param key - The key to get the value for\n * @returns The value for the key\n */\nexport function nativeStoreGet(key: string): string | null {\n if (Platform.OS === 'web') {\n if (typeof localStorage === 'undefined') {\n // eslint-disable-next-line no-console\n console.warn(ssrUnsupportedWarning);\n return null;\n }\n return localStorage.getItem(key);\n }\n return GtReactNative.nativeStoreGet(key);\n}\n\n/**\n * Set a value in the native store\n * @param key - The key to set the value for\n * @param value - The value to set\n */\nexport function nativeStoreSet(key: string, value: string): void {\n if (Platform.OS === 'web') {\n if (typeof localStorage === 'undefined') {\n // eslint-disable-next-line no-console\n console.warn(ssrUnsupportedWarning);\n return;\n }\n localStorage.setItem(key, value);\n return;\n }\n GtReactNative.nativeStoreSet(key, value);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgBA,SAAgB,yBACd,OAAA,GAAA,oCAAA,gBAAqB,CAAC,qBAAqB,EAC5B;AACf,QAAO,eAAe,IAAI;;;;;;;AAQ5B,SAAgB,eAAe,KAA4B;AACzD,KAAIA,aAAAA,SAAS,OAAO,OAAO;AACzB,MAAI,OAAO,iBAAiB,aAAa;AAEvC,WAAQ,KAAKC,4BAAAA,sBAAsB;AACnC,UAAO;;AAET,SAAO,aAAa,QAAQ,IAAI;;AAElC,QAAOC,4BAAAA,cAAc,eAAe,IAAI;;;;;;;AAQ1C,SAAgB,eAAe,KAAa,OAAqB;AAC/D,KAAIF,aAAAA,SAAS,OAAO,OAAO;AACzB,MAAI,OAAO,iBAAiB,aAAa;AAEvC,WAAQ,KAAKC,4BAAAA,sBAAsB;AACnC;;AAEF,eAAa,QAAQ,KAAK,MAAM;AAChC;;AAEF,6BAAA,cAAc,eAAe,KAAK,MAAM"}
@@ -3,8 +3,7 @@ require("../_virtual/_rolldown/runtime.js");
3
3
  let gt_i18n_internal = require("gt-i18n/internal");
4
4
  //#region src/utils/resolveLocale.ts
5
5
  function resolveLocale(candidates) {
6
- const i18nConfig = (0, gt_i18n_internal.getI18nConfig)();
7
- return i18nConfig.determineLocale(candidates ?? void 0) || i18nConfig.getDefaultLocale();
6
+ return (0, gt_i18n_internal.getI18nConfig)().resolveSupportedLocale(candidates ?? void 0);
8
7
  }
9
8
  //#endregion
10
9
  exports.resolveLocale = resolveLocale;