gt-tanstack-start 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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,198 @@
1
1
  # gt-tanstack-start
2
2
 
3
+ ## 11.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#1439](https://github.com/generaltranslation/gt/pull/1439) [`e12fb17`](https://github.com/generaltranslation/gt/commit/e12fb17d41cfa5fa231e64fe70423434739ea985) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - Prepare Odysseus major releases for core runtime packages.
8
+
9
+ ### Patch Changes
10
+
11
+ - [#1439](https://github.com/generaltranslation/gt/pull/1439) [`7a9dbe3`](https://github.com/generaltranslation/gt/commit/7a9dbe3c188787a39ee1de78f54c92dff470b502) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - Clean up stale package metadata and align TanStack Start package entry points.
12
+
13
+ - [#1439](https://github.com/generaltranslation/gt/pull/1439) [`b3bb391`](https://github.com/generaltranslation/gt/commit/b3bb391d33041680e2d62b6a7c9b05662946544f) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - Store cookie names in I18nConfig so custom cookie names work before the condition store is initialized.
14
+ - `gt-i18n`: Removed the unused React locale cookie name from the shared GT config type.
15
+ - `@generaltranslation/react-core`: `ReactI18nConfig` now accepts `localeCookieName`, `regionCookieName`, and `enableI18nCookieName`, exposes getters that fall back to the default names, and exports the default storage names from the `pure` entrypoint.
16
+ - `gt-next`: Imports default cookie names from the React Core `pure` entrypoint instead of the removed React Core cookie constants subpath.
17
+ - `gt-react`: The browser condition store now resolves cookie names from `I18nConfig` instead of hardcoding the defaults, so custom cookie names passed to `initializeGT()` are honored for both reads and writes.
18
+ - `gt-react-native`: Native condition storage now resolves its store keys from `I18nConfig`, matching `gt-react` behavior.
19
+ - `gt-tanstack-start`: `parseLocale()` reads and writes the locale cookie using the configured cookie name instead of the default.
20
+
21
+ - [#1439](https://github.com/generaltranslation/gt/pull/1439) [`d48604e`](https://github.com/generaltranslation/gt/commit/d48604e2171aa84c76873cacb6eb8d43c2f17546) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - Trigger an odysseus prerelease patch for all publishable packages.
22
+
23
+ - [#1439](https://github.com/generaltranslation/gt/pull/1439) [`2c46baf`](https://github.com/generaltranslation/gt/commit/2c46baf137400613495e3fe2865865b5506edece) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - Persist TanStack Start locale resolution through the browser locale cookie.
24
+ Allow React i18n config checks to work across bundled react-core entrypoints.
25
+
26
+ - [#1439](https://github.com/generaltranslation/gt/pull/1439) [`efbd970`](https://github.com/generaltranslation/gt/commit/efbd9704d43912e3febb888e7acb3670fc9e70fc) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - Consolidate TanStack Start package entrypoint exports.
27
+
28
+ - [#1439](https://github.com/generaltranslation/gt/pull/1439) [`9804aa4`](https://github.com/generaltranslation/gt/commit/9804aa460c07ec36d2e667d79a839720a1e011e8) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - Remove three orphaned, never-imported files:
29
+ - `gt-tanstack-start`: `condition-store/WritableConditionStore.ts` (an orphaned local copy; the package uses gt-i18n's writable condition store).
30
+ - `gt-react-native`: `utils/utils.ts` (`readAuthFromEnv`, no consumers).
31
+ - `gt-i18n`: `i18n-cache/translations-manager/utils/types/translations-manager.ts` (unreferenced `TranslationsManagerConfig` type).
32
+
33
+ - Updated dependencies [[`463a8db`](https://github.com/generaltranslation/gt/commit/463a8dbb03bde35f2f229dfdabfe117197d4527b), [`37e0080`](https://github.com/generaltranslation/gt/commit/37e0080b2c072840cf6c0f1c66a8f0f3a54e17e5), [`5bfd0a7`](https://github.com/generaltranslation/gt/commit/5bfd0a73e286bf76ae26f9178171aeca1c53ecc5), [`8870496`](https://github.com/generaltranslation/gt/commit/88704963eb74e81401994681ce7cdae3ba91b6c0), [`7a9dbe3`](https://github.com/generaltranslation/gt/commit/7a9dbe3c188787a39ee1de78f54c92dff470b502), [`1212135`](https://github.com/generaltranslation/gt/commit/1212135e4e09ed754756cac2805bc3a139408dc1), [`04f419d`](https://github.com/generaltranslation/gt/commit/04f419d65e69db3eb4adb8ee6299c0ddee153135), [`bd52e5e`](https://github.com/generaltranslation/gt/commit/bd52e5ef3fb38a63d9bac8a4af08ff93402c0749), [`b72c30b`](https://github.com/generaltranslation/gt/commit/b72c30bc603562310a51b656fb003f1486315a8a), [`72e9e16`](https://github.com/generaltranslation/gt/commit/72e9e1643797be8e4ae1453897fd0b023fce2674), [`42a440f`](https://github.com/generaltranslation/gt/commit/42a440ff3420bdbdb35ed24f9a5af1c9040eaf66), [`fd22c68`](https://github.com/generaltranslation/gt/commit/fd22c68978af50ce519dc06c7b887d3fa67181ae), [`bea8233`](https://github.com/generaltranslation/gt/commit/bea8233d8b055980483cb2e226157f6adcbd8c2b), [`8870496`](https://github.com/generaltranslation/gt/commit/88704963eb74e81401994681ce7cdae3ba91b6c0), [`5736d58`](https://github.com/generaltranslation/gt/commit/5736d585b8285ef56cc6f412799308969ac786c0), [`8d2e84e`](https://github.com/generaltranslation/gt/commit/8d2e84e5083bb740815004bec90eaa341be7aff5), [`04b5064`](https://github.com/generaltranslation/gt/commit/04b50645675abb9e927a82056b249b50f0907fcc), [`4335432`](https://github.com/generaltranslation/gt/commit/43354326beb16e13784b0c82faad447768bb8404), [`04c285c`](https://github.com/generaltranslation/gt/commit/04c285c7b44f5404918cd4c80336dddf412472e9), [`947fe0c`](https://github.com/generaltranslation/gt/commit/947fe0c97a2821a0980cd3e779252ea0078e80f8), [`5adeede`](https://github.com/generaltranslation/gt/commit/5adeede157922d547a33a078d0f527f572c9a8b4), [`e026c42`](https://github.com/generaltranslation/gt/commit/e026c42bc137e9865b548daee7238e6a458a5662), [`328795b`](https://github.com/generaltranslation/gt/commit/328795bf730296658a57b7132bbd1e0bbff2fd62), [`1f53e42`](https://github.com/generaltranslation/gt/commit/1f53e420e9a6475f85cf27e1cd0c9c89f4beeb36), [`b3bb391`](https://github.com/generaltranslation/gt/commit/b3bb391d33041680e2d62b6a7c9b05662946544f), [`d48604e`](https://github.com/generaltranslation/gt/commit/d48604e2171aa84c76873cacb6eb8d43c2f17546), [`e12fb17`](https://github.com/generaltranslation/gt/commit/e12fb17d41cfa5fa231e64fe70423434739ea985), [`44bc998`](https://github.com/generaltranslation/gt/commit/44bc998abf813ea4a96ade6c2632e1143034bd45), [`5752fe8`](https://github.com/generaltranslation/gt/commit/5752fe81bf5b5deaae878638e0de99959bf719be), [`7744c55`](https://github.com/generaltranslation/gt/commit/7744c557d37c85ce3626681410cc0cd622374ecf), [`b7d44dc`](https://github.com/generaltranslation/gt/commit/b7d44dc2d79ac3332a0ed55da0ba130b6896f756), [`9561761`](https://github.com/generaltranslation/gt/commit/9561761c3ab72a5e39327415b3274eccc63f4ffe), [`72c6a85`](https://github.com/generaltranslation/gt/commit/72c6a85cc3ca025ebdeb006dbdd865e935ec77ae), [`3d95277`](https://github.com/generaltranslation/gt/commit/3d95277a057b28fffc73b3fa616210bdcb447e85), [`97dc7f4`](https://github.com/generaltranslation/gt/commit/97dc7f4818476a319a54b1519e994a62d5a9a3a5), [`c1e0a0f`](https://github.com/generaltranslation/gt/commit/c1e0a0f837da440eeed84af10b553dee24bfc936), [`85a0c19`](https://github.com/generaltranslation/gt/commit/85a0c1998a6500233affd8c1987551170584c782), [`693288d`](https://github.com/generaltranslation/gt/commit/693288d632c42b923920a2fdd9ae2babc1bc28f5), [`463a8db`](https://github.com/generaltranslation/gt/commit/463a8dbb03bde35f2f229dfdabfe117197d4527b), [`e343775`](https://github.com/generaltranslation/gt/commit/e343775d8a41ce3eea03dd319b90497a9744cc4f), [`40db0c5`](https://github.com/generaltranslation/gt/commit/40db0c54a58e82d693d8a16d19fe5071baabecdc), [`8a2f7ee`](https://github.com/generaltranslation/gt/commit/8a2f7ee79f4b890fb1aaf47f42bb844334899793), [`c5364f9`](https://github.com/generaltranslation/gt/commit/c5364f977ffb4b387ad39206e6ed626bbeec56f3), [`2e85ebd`](https://github.com/generaltranslation/gt/commit/2e85ebd1528a4f99a8e36e1d8d6714a639040596), [`2c46baf`](https://github.com/generaltranslation/gt/commit/2c46baf137400613495e3fe2865865b5506edece), [`d5cf2d3`](https://github.com/generaltranslation/gt/commit/d5cf2d34f412ad49e8b2818fe788b870a5964d65), [`9e78cf0`](https://github.com/generaltranslation/gt/commit/9e78cf07db58bfe6063bcd0b217553176c9681bd), [`4986567`](https://github.com/generaltranslation/gt/commit/498656728741898a56ae348a536107bd92f95c04), [`795edc8`](https://github.com/generaltranslation/gt/commit/795edc8a2b3e91fc9801d726f4b5cd6fbbc98fb0), [`d863bcf`](https://github.com/generaltranslation/gt/commit/d863bcf05770c336c98b2b2fae8534c90f00df51), [`11ecf87`](https://github.com/generaltranslation/gt/commit/11ecf876a1221b9dbce9fc0c0f0804101558c8a7), [`03bae6d`](https://github.com/generaltranslation/gt/commit/03bae6d3b4791107781cb800c1ae7ac4f675705c), [`5d42608`](https://github.com/generaltranslation/gt/commit/5d426089f04f37dd7369620e9db3e6512f06eee8), [`9804aa4`](https://github.com/generaltranslation/gt/commit/9804aa460c07ec36d2e667d79a839720a1e011e8), [`338e5e8`](https://github.com/generaltranslation/gt/commit/338e5e8a42354c7d288d9be960ebd1d58adfd402), [`8834c51`](https://github.com/generaltranslation/gt/commit/8834c518ac84259706f2b603fd024ad13a9072ee), [`2ca78ec`](https://github.com/generaltranslation/gt/commit/2ca78ec4805639c10c7b200c8dee660b55eddf15), [`195f009`](https://github.com/generaltranslation/gt/commit/195f00910c2a675a6f9da327e19e3d3c5e44e26b)]:
34
+ - gt-i18n@1.0.0
35
+ - @generaltranslation/react-core@11.0.0
36
+ - gt-react@11.0.0
37
+ - generaltranslation@9.0.0
38
+
39
+ ## 11.0.0-odysseus.16
40
+
41
+ ### Patch Changes
42
+
43
+ - Updated dependencies [463a8db]
44
+ - Updated dependencies [b72c30b]
45
+ - Updated dependencies [bea8233]
46
+ - Updated dependencies [5736d58]
47
+ - Updated dependencies [1f53e42]
48
+ - Updated dependencies [7744c55]
49
+ - Updated dependencies [463a8db]
50
+ - Updated dependencies [e343775]
51
+ - Updated dependencies [40db0c5]
52
+ - Updated dependencies [d5cf2d3]
53
+ - gt-i18n@1.0.0-odysseus.9
54
+ - @generaltranslation/react-core@11.0.0-odysseus.16
55
+ - gt-react@11.0.0-odysseus.16
56
+ - generaltranslation@9.0.0-odysseus.6
57
+
58
+ ## 11.0.0-odysseus.15
59
+
60
+ ### Patch Changes
61
+
62
+ - Updated dependencies [04f419d]
63
+ - Updated dependencies [72e9e16]
64
+ - Updated dependencies [42a440f]
65
+ - Updated dependencies [8d2e84e]
66
+ - Updated dependencies [5adeede]
67
+ - Updated dependencies [c5364f9]
68
+ - Updated dependencies [2e85ebd]
69
+ - Updated dependencies [195f009]
70
+ - @generaltranslation/react-core@11.0.0-odysseus.15
71
+ - generaltranslation@9.0.0-odysseus.5
72
+ - gt-i18n@1.0.0-odysseus.8
73
+ - gt-react@11.0.0-odysseus.15
74
+
75
+ ## 11.0.0-odysseus.14
76
+
77
+ ### Patch Changes
78
+
79
+ - 0cd7813: Store cookie names in I18nConfig so custom cookie names work before the condition store is initialized.
80
+ - `gt-i18n`: Removed the unused React locale cookie name from the shared GT config type.
81
+ - `@generaltranslation/react-core`: `ReactI18nConfig` now accepts `localeCookieName`, `regionCookieName`, and `enableI18nCookieName`, exposes getters that fall back to the default names, and exports the default storage names from the `pure` entrypoint.
82
+ - `gt-next`: Imports default cookie names from the React Core `pure` entrypoint instead of the removed React Core cookie constants subpath.
83
+ - `gt-react`: The browser condition store now resolves cookie names from `I18nConfig` instead of hardcoding the defaults, so custom cookie names passed to `initializeGT()` are honored for both reads and writes.
84
+ - `gt-react-native`: Native condition storage now resolves its store keys from `I18nConfig`, matching `gt-react` behavior.
85
+ - `gt-tanstack-start`: `parseLocale()` reads and writes the locale cookie using the configured cookie name instead of the default.
86
+
87
+ - Updated dependencies [ab61565]
88
+ - Updated dependencies [0cd7813]
89
+ - gt-i18n@1.0.0-odysseus.7
90
+ - @generaltranslation/react-core@11.0.0-odysseus.14
91
+ - gt-react@11.0.0-odysseus.14
92
+
93
+ ## 11.0.0-odysseus.13
94
+
95
+ ### Patch Changes
96
+
97
+ - Updated dependencies [a2b9677]
98
+ - Updated dependencies [41371e0]
99
+ - gt-i18n@1.0.0-odysseus.6
100
+ - gt-react@11.0.0-odysseus.13
101
+ - @generaltranslation/react-core@11.0.0-odysseus.13
102
+
103
+ ## 11.0.0-odysseus.12
104
+
105
+ ### Patch Changes
106
+
107
+ - cde28be: Consolidate TanStack Start package entrypoint exports.
108
+ - Updated dependencies [7be23bc]
109
+ - @generaltranslation/react-core@11.0.0-odysseus.12
110
+ - gt-react@11.0.0-odysseus.12
111
+
112
+ ## 11.0.0-odysseus.11
113
+
114
+ ### Patch Changes
115
+
116
+ - @generaltranslation/react-core@11.0.0-odysseus.11
117
+ - gt-react@11.0.0-odysseus.11
118
+
119
+ ## 11.0.0-odysseus.10
120
+
121
+ ### Patch Changes
122
+
123
+ - 07f74f0: Clean up stale package metadata and align TanStack Start package entry points.
124
+ - Updated dependencies [432fa49]
125
+ - Updated dependencies [07f74f0]
126
+ - Updated dependencies [432fa49]
127
+ - Updated dependencies [ee34fea]
128
+ - Updated dependencies [bcba6fd]
129
+ - Updated dependencies [933916e]
130
+ - Updated dependencies [b7b3eaf]
131
+ - Updated dependencies [dfb5fc9]
132
+ - Updated dependencies [4a5f8e8]
133
+ - Updated dependencies [288c9f8]
134
+ - Updated dependencies [083d306]
135
+ - gt-i18n@1.0.0-odysseus.5
136
+ - gt-react@11.0.0-odysseus.10
137
+ - @generaltranslation/react-core@11.0.0-odysseus.10
138
+
139
+ ## 11.0.0-odysseus.9
140
+
141
+ ### Patch Changes
142
+
143
+ - @generaltranslation/react-core@11.0.0-odysseus.9
144
+ - gt-react@11.0.0-odysseus.9
145
+
146
+ ## 11.0.0-odysseus.8
147
+
148
+ ### Patch Changes
149
+
150
+ - Updated dependencies [26faa87]
151
+ - Updated dependencies [270b821]
152
+ - Updated dependencies [bffaa67]
153
+ - Updated dependencies [d602065]
154
+ - Updated dependencies [6da26e8]
155
+ - generaltranslation@9.0.0-odysseus.4
156
+ - gt-i18n@1.0.0-odysseus.4
157
+ - @generaltranslation/react-core@11.0.0-odysseus.8
158
+ - gt-react@11.0.0-odysseus.8
159
+
160
+ ## 11.0.0-odysseus.7
161
+
162
+ ### Patch Changes
163
+
164
+ - b765174: Remove three orphaned, never-imported files:
165
+ - `gt-tanstack-start`: `condition-store/WritableConditionStore.ts` (an orphaned local copy; the package uses gt-i18n's writable condition store).
166
+ - `gt-react-native`: `utils/utils.ts` (`readAuthFromEnv`, no consumers).
167
+ - `gt-i18n`: `i18n-cache/translations-manager/utils/types/translations-manager.ts` (unreferenced `TranslationsManagerConfig` type).
168
+
169
+ - Updated dependencies [b1eef00]
170
+ - Updated dependencies [b765174]
171
+ - Updated dependencies [07bfb00]
172
+ - generaltranslation@9.0.0-odysseus.3
173
+ - gt-i18n@1.0.0-odysseus.3
174
+ - @generaltranslation/react-core@11.0.0-odysseus.7
175
+ - gt-react@11.0.0-odysseus.7
176
+
177
+ ## 11.0.0-odysseus.6
178
+
179
+ ### Patch Changes
180
+
181
+ - Updated dependencies [c1aa794]
182
+ - Updated dependencies [e0ace5b]
183
+ - @generaltranslation/react-core@11.0.0-odysseus.6
184
+ - gt-react@11.0.0-odysseus.6
185
+
186
+ ## 11.0.0-odysseus.5
187
+
188
+ ### Patch Changes
189
+
190
+ - Updated dependencies [[`795147f`](https://github.com/generaltranslation/gt/commit/795147f5b00f948b2b1876a919c0a16cf53c52b6), [`4b97bc3`](https://github.com/generaltranslation/gt/commit/4b97bc360b2869bbb6e5f214589ef84f6d58a660), [`020c6bd`](https://github.com/generaltranslation/gt/commit/020c6bdd8c604bc07d80d75e8ea2ace1e70d7447), [`41c938c`](https://github.com/generaltranslation/gt/commit/41c938c0d00f4b76faa7a2805ad0015891e0740e), [`b3c3b9a`](https://github.com/generaltranslation/gt/commit/b3c3b9af39f1b2abec2c2b6bf2c2a40fe76db5ce)]:
191
+ - gt-react@11.0.0-odysseus.5
192
+ - generaltranslation@9.0.0-odysseus.2
193
+ - @generaltranslation/react-core@11.0.0-odysseus.5
194
+ - gt-i18n@1.0.0-odysseus.2
195
+
3
196
  ## 11.0.0-odysseus.4
4
197
 
5
198
  ### Patch Changes
@@ -100,6 +293,78 @@
100
293
 
101
294
  ### Patch Changes
102
295
 
296
+ - Updated dependencies []:
297
+ - gt-i18n@0.9.4
298
+ - gt-react@10.19.18
299
+ - @generaltranslation/react-core@1.8.20
300
+
301
+ ## 0.4.29
302
+
303
+ ### Patch Changes
304
+
305
+ - Updated dependencies [[`6945a98`](https://github.com/generaltranslation/gt/commit/6945a9871ea260dd999dcb2246c48b21134721f6)]:
306
+ - @generaltranslation/react-core@1.8.25
307
+ - generaltranslation@8.2.19
308
+ - gt-i18n@0.9.9
309
+ - gt-react@10.20.5
310
+
311
+ ## 0.4.28
312
+
313
+ ### Patch Changes
314
+
315
+ - Updated dependencies []:
316
+ - gt-i18n@0.9.8
317
+ - gt-react@10.20.4
318
+ - @generaltranslation/react-core@1.8.24
319
+
320
+ ## 0.4.27
321
+
322
+ ### Patch Changes
323
+
324
+ - Updated dependencies [[`9709a2f`](https://github.com/generaltranslation/gt/commit/9709a2f2b97b9d8239298e39bb31e57692bbffd8)]:
325
+ - generaltranslation@8.2.18
326
+ - gt-i18n@0.9.7
327
+ - gt-react@10.20.3
328
+ - @generaltranslation/react-core@1.8.23
329
+
330
+ ## 0.4.26
331
+
332
+ ### Patch Changes
333
+
334
+ - Updated dependencies [[`3197028`](https://github.com/generaltranslation/gt/commit/319702855a7b129f95217d41be9f2402680a2f01)]:
335
+ - generaltranslation@8.2.17
336
+ - gt-i18n@0.9.6
337
+ - gt-react@10.20.2
338
+ - @generaltranslation/react-core@1.8.22
339
+
340
+ ## 0.4.25
341
+
342
+ ### Patch Changes
343
+
344
+ - Updated dependencies []:
345
+ - gt-react@10.20.1
346
+
347
+ ## 0.4.24
348
+
349
+ ### Patch Changes
350
+
351
+ - Updated dependencies []:
352
+ - gt-react@10.20.0
353
+
354
+ ## 0.4.23
355
+
356
+ ### Patch Changes
357
+
358
+ - Updated dependencies [[`e041312`](https://github.com/generaltranslation/gt/commit/e04131263dd61e469db977bcc196dc1283e773d0)]:
359
+ - generaltranslation@8.2.16
360
+ - gt-i18n@0.9.5
361
+ - gt-react@10.19.19
362
+ - @generaltranslation/react-core@1.8.21
363
+
364
+ ## 0.4.22
365
+
366
+ ### Patch Changes
367
+
103
368
  - Updated dependencies []:
104
369
  - gt-i18n@0.9.4
105
370
  - gt-react@10.19.18
@@ -1,16 +1,15 @@
1
- "use client";
2
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- let gt_react = require("gt-react");
4
2
  let _tanstack_react_start = require("@tanstack/react-start");
5
3
  let _tanstack_react_start_server = require("@tanstack/react-start/server");
6
- let gt_i18n_internal = require("gt-i18n/internal");
4
+ let _generaltranslation_react_core_pure = require("@generaltranslation/react-core/pure");
5
+ let gt_react = require("gt-react");
7
6
  //#region src/functions/parseLocale.ts
8
7
  const determineLocale = (0, _tanstack_react_start.createIsomorphicFn)().server(determineLocaleServer).client(determineLocaleClient);
9
8
  /**
10
9
  * Resolve the user's locale for the current TanStack Start request or browser.
11
10
  */
12
11
  function parseLocale() {
13
- const i18nConfig = (0, gt_i18n_internal.getI18nConfig)();
12
+ const i18nConfig = (0, _generaltranslation_react_core_pure.getI18nConfig)();
14
13
  return determineLocale({
15
14
  defaultLocale: i18nConfig.getDefaultLocale(),
16
15
  locales: i18nConfig.getLocales(),
@@ -18,18 +17,20 @@ function parseLocale() {
18
17
  });
19
18
  }
20
19
  function determineLocaleServer({ defaultLocale, locales, customMapping }) {
20
+ const i18nConfig = (0, _generaltranslation_react_core_pure.getI18nConfig)();
21
+ const localeCookieName = i18nConfig.getLocaleCookieName();
21
22
  const candidates = [];
22
- const cookie = (0, _tanstack_react_start_server.getCookie)(gt_react.defaultLocaleCookieName);
23
+ const cookie = (0, _tanstack_react_start_server.getCookie)(localeCookieName);
23
24
  if (cookie) candidates.push(cookie);
24
25
  const headers = (0, _tanstack_react_start_server.getRequestHeader)("accept-language")?.split(",").map((item) => item.split(";")?.[0].trim()) || [];
25
26
  candidates.push(...headers);
26
27
  if (candidates.length === 0) console.warn("gt-tanstack-start(server): no locales could be determined for this request");
27
- const locale = (0, gt_i18n_internal.getI18nConfig)().resolveSupportedLocale(candidates, {
28
+ const locale = i18nConfig.resolveSupportedLocale(candidates, {
28
29
  defaultLocale,
29
30
  locales,
30
31
  customMapping
31
32
  });
32
- (0, _tanstack_react_start_server.setCookie)(gt_react.defaultLocaleCookieName, locale, {
33
+ (0, _tanstack_react_start_server.setCookie)(localeCookieName, locale, {
33
34
  path: "/",
34
35
  sameSite: "lax",
35
36
  maxAge: 3600 * 24 * 365
@@ -37,11 +38,13 @@ function determineLocaleServer({ defaultLocale, locales, customMapping }) {
37
38
  return locale;
38
39
  }
39
40
  function determineLocaleClient({ defaultLocale, locales, customMapping }) {
41
+ const i18nConfig = (0, _generaltranslation_react_core_pure.getI18nConfig)();
42
+ const localeCookieName = i18nConfig.getLocaleCookieName();
40
43
  const candidates = [];
41
- const cookie = document.cookie.split("; ").find((row) => row.startsWith(`${gt_react.defaultLocaleCookieName}=`))?.slice(gt_react.defaultLocaleCookieName.length + 1);
44
+ const cookie = document.cookie.split("; ").find((row) => row.startsWith(`${localeCookieName}=`))?.slice(localeCookieName.length + 1);
42
45
  if (cookie) candidates.push(cookie);
43
46
  if (candidates.length === 0) console.warn("gt-tanstack-start(client): no locales could be determined for this request");
44
- return (0, gt_i18n_internal.getI18nConfig)().resolveSupportedLocale(candidates, {
47
+ return i18nConfig.resolveSupportedLocale(candidates, {
45
48
  defaultLocale,
46
49
  locales,
47
50
  customMapping
@@ -254,4 +257,4 @@ Object.defineProperty(exports, "useTranslations", {
254
257
  }
255
258
  });
256
259
 
257
- //# sourceMappingURL=index.client.cjs.map
260
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../src/functions/parseLocale.ts"],"sourcesContent":["import { createIsomorphicFn } from '@tanstack/react-start';\nimport {\n getRequestHeader,\n getCookie,\n setCookie,\n} from '@tanstack/react-start/server';\nimport { getI18nConfig } from '@generaltranslation/react-core/pure';\nimport type { LocaleResolverConfig } from 'gt-i18n/internal/types';\n\nexport const determineLocale = createIsomorphicFn()\n .server(determineLocaleServer)\n .client(determineLocaleClient);\n\n/**\n * Resolve the user's locale for the current TanStack Start request or browser.\n */\nexport function parseLocale(): string {\n const i18nConfig = getI18nConfig();\n return determineLocale({\n defaultLocale: i18nConfig.getDefaultLocale(),\n locales: i18nConfig.getLocales(),\n customMapping: i18nConfig.getCustomMapping(),\n });\n}\n\nfunction determineLocaleServer({\n defaultLocale,\n locales,\n customMapping,\n}: LocaleResolverConfig) {\n const i18nConfig = getI18nConfig();\n const localeCookieName = i18nConfig.getLocaleCookieName();\n const candidates: string[] = [];\n\n const cookie = getCookie(localeCookieName);\n if (cookie) candidates.push(cookie);\n\n const headers =\n getRequestHeader('accept-language')\n ?.split(',')\n .map((item) => item.split(';')?.[0].trim()) || [];\n candidates.push(...headers);\n\n if (candidates.length === 0) {\n console.warn(\n 'gt-tanstack-start(server): no locales could be determined for this request'\n );\n }\n\n const locale = i18nConfig.resolveSupportedLocale(candidates, {\n defaultLocale,\n locales,\n customMapping,\n });\n\n setCookie(localeCookieName, locale, {\n path: '/',\n sameSite: 'lax',\n maxAge: 60 * 60 * 24 * 365,\n });\n\n return locale;\n}\n\nfunction determineLocaleClient({\n defaultLocale,\n locales,\n customMapping,\n}: LocaleResolverConfig) {\n const i18nConfig = getI18nConfig();\n const localeCookieName = i18nConfig.getLocaleCookieName();\n const candidates: string[] = [];\n\n const cookie = document.cookie\n .split('; ')\n .find((row) => row.startsWith(`${localeCookieName}=`))\n ?.slice(localeCookieName.length + 1);\n if (cookie) candidates.push(cookie);\n\n if (candidates.length === 0) {\n console.warn(\n 'gt-tanstack-start(client): no locales could be determined for this request'\n );\n }\n\n return i18nConfig.resolveSupportedLocale(candidates, {\n defaultLocale,\n locales,\n customMapping,\n });\n}\n"],"mappings":";;;;;;AASA,MAAa,mBAAA,GAAA,sBAAA,qBAAsC,CAChD,OAAO,sBAAsB,CAC7B,OAAO,sBAAsB;;;;AAKhC,SAAgB,cAAsB;CACpC,MAAM,cAAA,GAAA,oCAAA,gBAA4B;AAClC,QAAO,gBAAgB;EACrB,eAAe,WAAW,kBAAkB;EAC5C,SAAS,WAAW,YAAY;EAChC,eAAe,WAAW,kBAAkB;EAC7C,CAAC;;AAGJ,SAAS,sBAAsB,EAC7B,eACA,SACA,iBACuB;CACvB,MAAM,cAAA,GAAA,oCAAA,gBAA4B;CAClC,MAAM,mBAAmB,WAAW,qBAAqB;CACzD,MAAM,aAAuB,EAAE;CAE/B,MAAM,UAAA,GAAA,6BAAA,WAAmB,iBAAiB;AAC1C,KAAI,OAAQ,YAAW,KAAK,OAAO;CAEnC,MAAM,WAAA,GAAA,6BAAA,kBACa,kBAAkB,EAC/B,MAAM,IAAI,CACX,KAAK,SAAS,KAAK,MAAM,IAAI,GAAG,GAAG,MAAM,CAAC,IAAI,EAAE;AACrD,YAAW,KAAK,GAAG,QAAQ;AAE3B,KAAI,WAAW,WAAW,EACxB,SAAQ,KACN,6EACD;CAGH,MAAM,SAAS,WAAW,uBAAuB,YAAY;EAC3D;EACA;EACA;EACD,CAAC;AAEF,EAAA,GAAA,6BAAA,WAAU,kBAAkB,QAAQ;EAClC,MAAM;EACN,UAAU;EACV,QAAQ,OAAU,KAAK;EACxB,CAAC;AAEF,QAAO;;AAGT,SAAS,sBAAsB,EAC7B,eACA,SACA,iBACuB;CACvB,MAAM,cAAA,GAAA,oCAAA,gBAA4B;CAClC,MAAM,mBAAmB,WAAW,qBAAqB;CACzD,MAAM,aAAuB,EAAE;CAE/B,MAAM,SAAS,SAAS,OACrB,MAAM,KAAK,CACX,MAAM,QAAQ,IAAI,WAAW,GAAG,iBAAiB,GAAG,CAAC,EACpD,MAAM,iBAAiB,SAAS,EAAE;AACtC,KAAI,OAAQ,YAAW,KAAK,OAAO;AAEnC,KAAI,WAAW,WAAW,EACxB,SAAQ,KACN,6EACD;AAGH,QAAO,WAAW,uBAAuB,YAAY;EACnD;EACA;EACA;EACD,CAAC"}
@@ -7,4 +7,4 @@ import { Branch, Currency, DateTime, Derive, GTProvider, LocaleSelector, Num, Pl
7
7
  declare function parseLocale(): string;
8
8
  //#endregion
9
9
  export { Branch, Currency, DateTime, Derive, GTProvider, LocaleSelector, Num, Plural, RelativeTime, T, Var, declareVar, decodeMsg, decodeOptions, decodeVars, derive, getTranslationsSnapshot, gtFallback, initializeGT, mFallback, msg, parseLocale, t, useCustomMapping, useDefaultLocale, useEnableI18n, useFormatLocales, useGT, useLocale, useLocaleSelector, useLocales, useMessages, useSetEnableI18n, useSetLocale, useTranslations };
10
- //# sourceMappingURL=index.types.d.cts.map
10
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/functions/parseLocale.ts"],"mappings":";;;;;;iBAgBgB,WAAA,CAAA"}
@@ -6,4 +6,4 @@ import { Branch, Currency, DateTime, Derive, GTProvider, LocaleSelector, Num, Pl
6
6
  declare function parseLocale(): string;
7
7
  //#endregion
8
8
  export { Branch, Currency, DateTime, Derive, GTProvider, LocaleSelector, Num, Plural, RelativeTime, T, Var, declareVar, decodeMsg, decodeOptions, decodeVars, derive, getTranslationsSnapshot, gtFallback, initializeGT, mFallback, msg, parseLocale, t, useCustomMapping, useDefaultLocale, useEnableI18n, useFormatLocales, useGT, useLocale, useLocaleSelector, useLocales, useMessages, useSetEnableI18n, useSetLocale, useTranslations };
9
- //# sourceMappingURL=index.types.d.mts.map
9
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/functions/parseLocale.ts"],"mappings":";;;;;iBAgBgB,WAAA,CAAA"}
@@ -1,8 +1,7 @@
1
- "use client";
2
- import { Branch, Currency, DateTime, Derive, GTProvider, LocaleSelector, Num, Plural, RelativeTime, T, Var, declareVar, decodeMsg, decodeOptions, decodeVars, defaultLocaleCookieName, derive, getTranslationsSnapshot, gtFallback, initializeGT, mFallback, msg, t, useCustomMapping, useDefaultLocale, useEnableI18n, useFormatLocales, useGT, useLocale, useLocaleSelector, useLocales, useMessages, useSetEnableI18n, useSetLocale, useTranslations } from "gt-react";
3
1
  import { createIsomorphicFn } from "@tanstack/react-start";
4
2
  import { getCookie, getRequestHeader, setCookie } from "@tanstack/react-start/server";
5
- import { getI18nConfig } from "gt-i18n/internal";
3
+ import { getI18nConfig } from "@generaltranslation/react-core/pure";
4
+ import { Branch, Currency, DateTime, Derive, GTProvider, LocaleSelector, Num, Plural, RelativeTime, T, Var, declareVar, decodeMsg, decodeOptions, decodeVars, derive, getTranslationsSnapshot, gtFallback, initializeGT, mFallback, msg, t, useCustomMapping, useDefaultLocale, useEnableI18n, useFormatLocales, useGT, useLocale, useLocaleSelector, useLocales, useMessages, useSetEnableI18n, useSetLocale, useTranslations } from "gt-react";
6
5
  //#region src/functions/parseLocale.ts
7
6
  const determineLocale = createIsomorphicFn().server(determineLocaleServer).client(determineLocaleClient);
8
7
  /**
@@ -17,18 +16,20 @@ function parseLocale() {
17
16
  });
18
17
  }
19
18
  function determineLocaleServer({ defaultLocale, locales, customMapping }) {
19
+ const i18nConfig = getI18nConfig();
20
+ const localeCookieName = i18nConfig.getLocaleCookieName();
20
21
  const candidates = [];
21
- const cookie = getCookie(defaultLocaleCookieName);
22
+ const cookie = getCookie(localeCookieName);
22
23
  if (cookie) candidates.push(cookie);
23
24
  const headers = getRequestHeader("accept-language")?.split(",").map((item) => item.split(";")?.[0].trim()) || [];
24
25
  candidates.push(...headers);
25
26
  if (candidates.length === 0) console.warn("gt-tanstack-start(server): no locales could be determined for this request");
26
- const locale = getI18nConfig().resolveSupportedLocale(candidates, {
27
+ const locale = i18nConfig.resolveSupportedLocale(candidates, {
27
28
  defaultLocale,
28
29
  locales,
29
30
  customMapping
30
31
  });
31
- setCookie(defaultLocaleCookieName, locale, {
32
+ setCookie(localeCookieName, locale, {
32
33
  path: "/",
33
34
  sameSite: "lax",
34
35
  maxAge: 3600 * 24 * 365
@@ -36,11 +37,13 @@ function determineLocaleServer({ defaultLocale, locales, customMapping }) {
36
37
  return locale;
37
38
  }
38
39
  function determineLocaleClient({ defaultLocale, locales, customMapping }) {
40
+ const i18nConfig = getI18nConfig();
41
+ const localeCookieName = i18nConfig.getLocaleCookieName();
39
42
  const candidates = [];
40
- const cookie = document.cookie.split("; ").find((row) => row.startsWith(`${defaultLocaleCookieName}=`))?.slice(defaultLocaleCookieName.length + 1);
43
+ const cookie = document.cookie.split("; ").find((row) => row.startsWith(`${localeCookieName}=`))?.slice(localeCookieName.length + 1);
41
44
  if (cookie) candidates.push(cookie);
42
45
  if (candidates.length === 0) console.warn("gt-tanstack-start(client): no locales could be determined for this request");
43
- return getI18nConfig().resolveSupportedLocale(candidates, {
46
+ return i18nConfig.resolveSupportedLocale(candidates, {
44
47
  defaultLocale,
45
48
  locales,
46
49
  customMapping
@@ -49,4 +52,4 @@ function determineLocaleClient({ defaultLocale, locales, customMapping }) {
49
52
  //#endregion
50
53
  export { Branch, Currency, DateTime, Derive, GTProvider, LocaleSelector, Num, Plural, RelativeTime, T, Var, declareVar, decodeMsg, decodeOptions, decodeVars, derive, getTranslationsSnapshot, gtFallback, initializeGT, mFallback, msg, parseLocale, t, useCustomMapping, useDefaultLocale, useEnableI18n, useFormatLocales, useGT, useLocale, useLocaleSelector, useLocales, useMessages, useSetEnableI18n, useSetLocale, useTranslations };
51
54
 
52
- //# sourceMappingURL=index.client.mjs.map
55
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/functions/parseLocale.ts"],"sourcesContent":["import { createIsomorphicFn } from '@tanstack/react-start';\nimport {\n getRequestHeader,\n getCookie,\n setCookie,\n} from '@tanstack/react-start/server';\nimport { getI18nConfig } from '@generaltranslation/react-core/pure';\nimport type { LocaleResolverConfig } from 'gt-i18n/internal/types';\n\nexport const determineLocale = createIsomorphicFn()\n .server(determineLocaleServer)\n .client(determineLocaleClient);\n\n/**\n * Resolve the user's locale for the current TanStack Start request or browser.\n */\nexport function parseLocale(): string {\n const i18nConfig = getI18nConfig();\n return determineLocale({\n defaultLocale: i18nConfig.getDefaultLocale(),\n locales: i18nConfig.getLocales(),\n customMapping: i18nConfig.getCustomMapping(),\n });\n}\n\nfunction determineLocaleServer({\n defaultLocale,\n locales,\n customMapping,\n}: LocaleResolverConfig) {\n const i18nConfig = getI18nConfig();\n const localeCookieName = i18nConfig.getLocaleCookieName();\n const candidates: string[] = [];\n\n const cookie = getCookie(localeCookieName);\n if (cookie) candidates.push(cookie);\n\n const headers =\n getRequestHeader('accept-language')\n ?.split(',')\n .map((item) => item.split(';')?.[0].trim()) || [];\n candidates.push(...headers);\n\n if (candidates.length === 0) {\n console.warn(\n 'gt-tanstack-start(server): no locales could be determined for this request'\n );\n }\n\n const locale = i18nConfig.resolveSupportedLocale(candidates, {\n defaultLocale,\n locales,\n customMapping,\n });\n\n setCookie(localeCookieName, locale, {\n path: '/',\n sameSite: 'lax',\n maxAge: 60 * 60 * 24 * 365,\n });\n\n return locale;\n}\n\nfunction determineLocaleClient({\n defaultLocale,\n locales,\n customMapping,\n}: LocaleResolverConfig) {\n const i18nConfig = getI18nConfig();\n const localeCookieName = i18nConfig.getLocaleCookieName();\n const candidates: string[] = [];\n\n const cookie = document.cookie\n .split('; ')\n .find((row) => row.startsWith(`${localeCookieName}=`))\n ?.slice(localeCookieName.length + 1);\n if (cookie) candidates.push(cookie);\n\n if (candidates.length === 0) {\n console.warn(\n 'gt-tanstack-start(client): no locales could be determined for this request'\n );\n }\n\n return i18nConfig.resolveSupportedLocale(candidates, {\n defaultLocale,\n locales,\n customMapping,\n });\n}\n"],"mappings":";;;;;AASA,MAAa,kBAAkB,oBAAoB,CAChD,OAAO,sBAAsB,CAC7B,OAAO,sBAAsB;;;;AAKhC,SAAgB,cAAsB;CACpC,MAAM,aAAa,eAAe;AAClC,QAAO,gBAAgB;EACrB,eAAe,WAAW,kBAAkB;EAC5C,SAAS,WAAW,YAAY;EAChC,eAAe,WAAW,kBAAkB;EAC7C,CAAC;;AAGJ,SAAS,sBAAsB,EAC7B,eACA,SACA,iBACuB;CACvB,MAAM,aAAa,eAAe;CAClC,MAAM,mBAAmB,WAAW,qBAAqB;CACzD,MAAM,aAAuB,EAAE;CAE/B,MAAM,SAAS,UAAU,iBAAiB;AAC1C,KAAI,OAAQ,YAAW,KAAK,OAAO;CAEnC,MAAM,UACJ,iBAAiB,kBAAkB,EAC/B,MAAM,IAAI,CACX,KAAK,SAAS,KAAK,MAAM,IAAI,GAAG,GAAG,MAAM,CAAC,IAAI,EAAE;AACrD,YAAW,KAAK,GAAG,QAAQ;AAE3B,KAAI,WAAW,WAAW,EACxB,SAAQ,KACN,6EACD;CAGH,MAAM,SAAS,WAAW,uBAAuB,YAAY;EAC3D;EACA;EACA;EACD,CAAC;AAEF,WAAU,kBAAkB,QAAQ;EAClC,MAAM;EACN,UAAU;EACV,QAAQ,OAAU,KAAK;EACxB,CAAC;AAEF,QAAO;;AAGT,SAAS,sBAAsB,EAC7B,eACA,SACA,iBACuB;CACvB,MAAM,aAAa,eAAe;CAClC,MAAM,mBAAmB,WAAW,qBAAqB;CACzD,MAAM,aAAuB,EAAE;CAE/B,MAAM,SAAS,SAAS,OACrB,MAAM,KAAK,CACX,MAAM,QAAQ,IAAI,WAAW,GAAG,iBAAiB,GAAG,CAAC,EACpD,MAAM,iBAAiB,SAAS,EAAE;AACtC,KAAI,OAAQ,YAAW,KAAK,OAAO;AAEnC,KAAI,WAAW,WAAW,EACxB,SAAQ,KACN,6EACD;AAGH,QAAO,WAAW,uBAAuB,YAAY;EACnD;EACA;EACA;EACD,CAAC"}
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "gt-tanstack-start",
3
- "version": "11.0.0-odysseus.4",
3
+ "version": "11.0.0",
4
4
  "description": "TanStack Start integration for General Translation",
5
- "main": "./dist/index.client.cjs",
6
- "module": "./dist/index.client.mjs",
7
- "types": "./dist/index.types.d.cts",
5
+ "main": "./dist/index.cjs",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.cts",
8
8
  "files": [
9
9
  "dist",
10
10
  "CHANGELOG.md"
@@ -16,10 +16,10 @@
16
16
  "@tanstack/react-start": ">=1.159.0"
17
17
  },
18
18
  "dependencies": {
19
- "gt-react": "11.0.0-odysseus.4",
20
- "@generaltranslation/react-core": "11.0.0-odysseus.4",
21
- "gt-i18n": "1.0.0-odysseus.1",
22
- "generaltranslation": "9.0.0-odysseus.1"
19
+ "gt-react": "11.0.0",
20
+ "@generaltranslation/react-core": "11.0.0",
21
+ "gt-i18n": "1.0.0",
22
+ "generaltranslation": "9.0.0"
23
23
  },
24
24
  "repository": {
25
25
  "type": "git",
@@ -41,55 +41,15 @@
41
41
  },
42
42
  "exports": {
43
43
  ".": {
44
- "react-server": {
45
- "require": {
46
- "types": "./dist/index.types.d.cts",
47
- "default": "./dist/index.server.cjs"
48
- },
49
- "import": {
50
- "types": "./dist/index.types.d.mts",
51
- "default": "./dist/index.server.mjs"
52
- },
53
- "default": "./dist/index.server.mjs"
54
- },
55
- "browser": {
56
- "require": {
57
- "types": "./dist/index.types.d.cts",
58
- "default": "./dist/index.client.cjs"
59
- },
60
- "import": {
61
- "types": "./dist/index.types.d.mts",
62
- "default": "./dist/index.client.mjs"
63
- },
64
- "default": "./dist/index.client.mjs"
65
- },
66
44
  "require": {
67
- "types": "./dist/index.types.d.cts",
68
- "default": "./dist/index.server.cjs"
45
+ "types": "./dist/index.d.cts",
46
+ "default": "./dist/index.cjs"
69
47
  },
70
48
  "import": {
71
- "types": "./dist/index.types.d.mts",
72
- "default": "./dist/index.server.mjs"
49
+ "types": "./dist/index.d.mts",
50
+ "default": "./dist/index.mjs"
73
51
  },
74
- "default": "./dist/index.server.mjs"
75
- },
76
- "./types": {
77
- "types": "./dist/types.d.cts"
78
- }
79
- },
80
- "typesVersions": {
81
- "*": {
82
- "types": [
83
- "./dist/types.d.cts"
84
- ]
85
- }
86
- },
87
- "compilerOptions": {
88
- "baseUrl": ".",
89
- "paths": {
90
- "gt-tanstack-start/types": [
91
- "./dist/types.d.cts"
92
- ]
52
+ "default": "./dist/index.mjs"
93
53
  }
94
54
  },
95
55
  "keywords": [
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.client.cjs","names":["defaultLocaleCookieName"],"sources":["../src/functions/parseLocale.ts"],"sourcesContent":["import { defaultLocaleCookieName } from 'gt-react';\nimport { createIsomorphicFn } from '@tanstack/react-start';\nimport {\n getRequestHeader,\n getCookie,\n setCookie,\n} from '@tanstack/react-start/server';\nimport { getI18nConfig } from 'gt-i18n/internal';\nimport type { I18nConfigParams } from 'gt-i18n/internal/types';\n\nexport const determineLocale = createIsomorphicFn()\n .server(determineLocaleServer)\n .client(determineLocaleClient);\n\n/**\n * Resolve the user's locale for the current TanStack Start request or browser.\n */\nexport function parseLocale(): string {\n const i18nConfig = getI18nConfig();\n return determineLocale({\n defaultLocale: i18nConfig.getDefaultLocale(),\n locales: i18nConfig.getLocales(),\n customMapping: i18nConfig.getCustomMapping(),\n });\n}\n\nfunction determineLocaleServer({\n defaultLocale,\n locales,\n customMapping,\n}: I18nConfigParams) {\n const candidates: string[] = [];\n\n const cookie = getCookie(defaultLocaleCookieName);\n if (cookie) candidates.push(cookie);\n\n const headers =\n getRequestHeader('accept-language')\n ?.split(',')\n .map((item) => item.split(';')?.[0].trim()) || [];\n candidates.push(...headers);\n\n if (candidates.length === 0) {\n console.warn(\n 'gt-tanstack-start(server): no locales could be determined for this request'\n );\n }\n\n const locale = getI18nConfig().resolveSupportedLocale(candidates, {\n defaultLocale,\n locales,\n customMapping,\n });\n\n setCookie(defaultLocaleCookieName, locale, {\n path: '/',\n sameSite: 'lax',\n maxAge: 60 * 60 * 24 * 365,\n });\n\n return locale;\n}\n\nfunction determineLocaleClient({\n defaultLocale,\n locales,\n customMapping,\n}: I18nConfigParams) {\n const candidates: string[] = [];\n\n const cookie = document.cookie\n .split('; ')\n .find((row) => row.startsWith(`${defaultLocaleCookieName}=`))\n ?.slice(defaultLocaleCookieName.length + 1);\n if (cookie) candidates.push(cookie);\n\n if (candidates.length === 0) {\n console.warn(\n 'gt-tanstack-start(client): no locales could be determined for this request'\n );\n }\n\n return getI18nConfig().resolveSupportedLocale(candidates, {\n defaultLocale,\n locales,\n customMapping,\n });\n}\n"],"mappings":";;;;;;;AAUA,MAAa,mBAAA,GAAA,sBAAA,qBAAsC,CAChD,OAAO,sBAAsB,CAC7B,OAAO,sBAAsB;;;;AAKhC,SAAgB,cAAsB;CACpC,MAAM,cAAA,GAAA,iBAAA,gBAA4B;AAClC,QAAO,gBAAgB;EACrB,eAAe,WAAW,kBAAkB;EAC5C,SAAS,WAAW,YAAY;EAChC,eAAe,WAAW,kBAAkB;EAC7C,CAAC;;AAGJ,SAAS,sBAAsB,EAC7B,eACA,SACA,iBACmB;CACnB,MAAM,aAAuB,EAAE;CAE/B,MAAM,UAAA,GAAA,6BAAA,WAAmBA,SAAAA,wBAAwB;AACjD,KAAI,OAAQ,YAAW,KAAK,OAAO;CAEnC,MAAM,WAAA,GAAA,6BAAA,kBACa,kBAAkB,EAC/B,MAAM,IAAI,CACX,KAAK,SAAS,KAAK,MAAM,IAAI,GAAG,GAAG,MAAM,CAAC,IAAI,EAAE;AACrD,YAAW,KAAK,GAAG,QAAQ;AAE3B,KAAI,WAAW,WAAW,EACxB,SAAQ,KACN,6EACD;CAGH,MAAM,UAAA,GAAA,iBAAA,gBAAwB,CAAC,uBAAuB,YAAY;EAChE;EACA;EACA;EACD,CAAC;AAEF,EAAA,GAAA,6BAAA,WAAUA,SAAAA,yBAAyB,QAAQ;EACzC,MAAM;EACN,UAAU;EACV,QAAQ,OAAU,KAAK;EACxB,CAAC;AAEF,QAAO;;AAGT,SAAS,sBAAsB,EAC7B,eACA,SACA,iBACmB;CACnB,MAAM,aAAuB,EAAE;CAE/B,MAAM,SAAS,SAAS,OACrB,MAAM,KAAK,CACX,MAAM,QAAQ,IAAI,WAAW,GAAGA,SAAAA,wBAAwB,GAAG,CAAC,EAC3D,MAAMA,SAAAA,wBAAwB,SAAS,EAAE;AAC7C,KAAI,OAAQ,YAAW,KAAK,OAAO;AAEnC,KAAI,WAAW,WAAW,EACxB,SAAQ,KACN,6EACD;AAGH,SAAA,GAAA,iBAAA,gBAAsB,CAAC,uBAAuB,YAAY;EACxD;EACA;EACA;EACD,CAAC"}
@@ -1,10 +0,0 @@
1
- import { Branch, Currency, DateTime, Derive, GTProvider, LocaleSelector, Num, Plural, RelativeTime, T, Var, declareVar, decodeMsg, decodeOptions, decodeVars, derive, getTranslationsSnapshot, gtFallback, initializeGT, mFallback, msg, t, useCustomMapping, useDefaultLocale, useEnableI18n, useFormatLocales, useGT, useLocale, useLocaleSelector, useLocales, useMessages, useSetEnableI18n, useSetLocale, useTranslations } from "gt-react";
2
-
3
- //#region src/functions/parseLocale.d.ts
4
- /**
5
- * Resolve the user's locale for the current TanStack Start request or browser.
6
- */
7
- declare function parseLocale(): string;
8
- //#endregion
9
- export { Branch, Currency, DateTime, Derive, GTProvider, LocaleSelector, Num, Plural, RelativeTime, T, Var, declareVar, decodeMsg, decodeOptions, decodeVars, derive, getTranslationsSnapshot, gtFallback, initializeGT, mFallback, msg, parseLocale, t, useCustomMapping, useDefaultLocale, useEnableI18n, useFormatLocales, useGT, useLocale, useLocaleSelector, useLocales, useMessages, useSetEnableI18n, useSetLocale, useTranslations };
10
- //# sourceMappingURL=index.client.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.client.d.cts","names":[],"sources":["../src/functions/parseLocale.ts"],"mappings":";;;;;;iBAiBgB,WAAA,CAAA"}
@@ -1,9 +0,0 @@
1
- import { Branch, Currency, DateTime, Derive, GTProvider, LocaleSelector, Num, Plural, RelativeTime, T, Var, declareVar, decodeMsg, decodeOptions, decodeVars, derive, getTranslationsSnapshot, gtFallback, initializeGT, mFallback, msg, t, useCustomMapping, useDefaultLocale, useEnableI18n, useFormatLocales, useGT, useLocale, useLocaleSelector, useLocales, useMessages, useSetEnableI18n, useSetLocale, useTranslations } from "gt-react";
2
- //#region src/functions/parseLocale.d.ts
3
- /**
4
- * Resolve the user's locale for the current TanStack Start request or browser.
5
- */
6
- declare function parseLocale(): string;
7
- //#endregion
8
- export { Branch, Currency, DateTime, Derive, GTProvider, LocaleSelector, Num, Plural, RelativeTime, T, Var, declareVar, decodeMsg, decodeOptions, decodeVars, derive, getTranslationsSnapshot, gtFallback, initializeGT, mFallback, msg, parseLocale, t, useCustomMapping, useDefaultLocale, useEnableI18n, useFormatLocales, useGT, useLocale, useLocaleSelector, useLocales, useMessages, useSetEnableI18n, useSetLocale, useTranslations };
9
- //# sourceMappingURL=index.client.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.client.d.mts","names":[],"sources":["../src/functions/parseLocale.ts"],"mappings":";;;;;iBAiBgB,WAAA,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.client.mjs","names":[],"sources":["../src/functions/parseLocale.ts"],"sourcesContent":["import { defaultLocaleCookieName } from 'gt-react';\nimport { createIsomorphicFn } from '@tanstack/react-start';\nimport {\n getRequestHeader,\n getCookie,\n setCookie,\n} from '@tanstack/react-start/server';\nimport { getI18nConfig } from 'gt-i18n/internal';\nimport type { I18nConfigParams } from 'gt-i18n/internal/types';\n\nexport const determineLocale = createIsomorphicFn()\n .server(determineLocaleServer)\n .client(determineLocaleClient);\n\n/**\n * Resolve the user's locale for the current TanStack Start request or browser.\n */\nexport function parseLocale(): string {\n const i18nConfig = getI18nConfig();\n return determineLocale({\n defaultLocale: i18nConfig.getDefaultLocale(),\n locales: i18nConfig.getLocales(),\n customMapping: i18nConfig.getCustomMapping(),\n });\n}\n\nfunction determineLocaleServer({\n defaultLocale,\n locales,\n customMapping,\n}: I18nConfigParams) {\n const candidates: string[] = [];\n\n const cookie = getCookie(defaultLocaleCookieName);\n if (cookie) candidates.push(cookie);\n\n const headers =\n getRequestHeader('accept-language')\n ?.split(',')\n .map((item) => item.split(';')?.[0].trim()) || [];\n candidates.push(...headers);\n\n if (candidates.length === 0) {\n console.warn(\n 'gt-tanstack-start(server): no locales could be determined for this request'\n );\n }\n\n const locale = getI18nConfig().resolveSupportedLocale(candidates, {\n defaultLocale,\n locales,\n customMapping,\n });\n\n setCookie(defaultLocaleCookieName, locale, {\n path: '/',\n sameSite: 'lax',\n maxAge: 60 * 60 * 24 * 365,\n });\n\n return locale;\n}\n\nfunction determineLocaleClient({\n defaultLocale,\n locales,\n customMapping,\n}: I18nConfigParams) {\n const candidates: string[] = [];\n\n const cookie = document.cookie\n .split('; ')\n .find((row) => row.startsWith(`${defaultLocaleCookieName}=`))\n ?.slice(defaultLocaleCookieName.length + 1);\n if (cookie) candidates.push(cookie);\n\n if (candidates.length === 0) {\n console.warn(\n 'gt-tanstack-start(client): no locales could be determined for this request'\n );\n }\n\n return getI18nConfig().resolveSupportedLocale(candidates, {\n defaultLocale,\n locales,\n customMapping,\n });\n}\n"],"mappings":";;;;;;AAUA,MAAa,kBAAkB,oBAAoB,CAChD,OAAO,sBAAsB,CAC7B,OAAO,sBAAsB;;;;AAKhC,SAAgB,cAAsB;CACpC,MAAM,aAAa,eAAe;AAClC,QAAO,gBAAgB;EACrB,eAAe,WAAW,kBAAkB;EAC5C,SAAS,WAAW,YAAY;EAChC,eAAe,WAAW,kBAAkB;EAC7C,CAAC;;AAGJ,SAAS,sBAAsB,EAC7B,eACA,SACA,iBACmB;CACnB,MAAM,aAAuB,EAAE;CAE/B,MAAM,SAAS,UAAU,wBAAwB;AACjD,KAAI,OAAQ,YAAW,KAAK,OAAO;CAEnC,MAAM,UACJ,iBAAiB,kBAAkB,EAC/B,MAAM,IAAI,CACX,KAAK,SAAS,KAAK,MAAM,IAAI,GAAG,GAAG,MAAM,CAAC,IAAI,EAAE;AACrD,YAAW,KAAK,GAAG,QAAQ;AAE3B,KAAI,WAAW,WAAW,EACxB,SAAQ,KACN,6EACD;CAGH,MAAM,SAAS,eAAe,CAAC,uBAAuB,YAAY;EAChE;EACA;EACA;EACD,CAAC;AAEF,WAAU,yBAAyB,QAAQ;EACzC,MAAM;EACN,UAAU;EACV,QAAQ,OAAU,KAAK;EACxB,CAAC;AAEF,QAAO;;AAGT,SAAS,sBAAsB,EAC7B,eACA,SACA,iBACmB;CACnB,MAAM,aAAuB,EAAE;CAE/B,MAAM,SAAS,SAAS,OACrB,MAAM,KAAK,CACX,MAAM,QAAQ,IAAI,WAAW,GAAG,wBAAwB,GAAG,CAAC,EAC3D,MAAM,wBAAwB,SAAS,EAAE;AAC7C,KAAI,OAAQ,YAAW,KAAK,OAAO;AAEnC,KAAI,WAAW,WAAW,EACxB,SAAQ,KACN,6EACD;AAGH,QAAO,eAAe,CAAC,uBAAuB,YAAY;EACxD;EACA;EACA;EACD,CAAC"}