gt-react 11.0.0-odysseus.9 → 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 +254 -0
- package/dist/index.client.cjs +98 -92
- package/dist/index.client.cjs.map +1 -1
- package/dist/index.client.d.cts +17 -39
- package/dist/index.client.d.cts.map +1 -1
- package/dist/index.client.d.mts +17 -39
- package/dist/index.client.d.mts.map +1 -1
- package/dist/index.client.mjs +96 -75
- package/dist/index.client.mjs.map +1 -1
- package/dist/index.rsc.cjs +15 -117
- package/dist/index.rsc.cjs.map +1 -1
- package/dist/index.rsc.d.cts +4 -11
- package/dist/index.rsc.d.cts.map +1 -1
- package/dist/index.rsc.d.mts +4 -11
- package/dist/index.rsc.d.mts.map +1 -1
- package/dist/index.rsc.mjs +8 -18
- package/dist/index.rsc.mjs.map +1 -1
- package/dist/index.server.cjs +51 -531
- package/dist/index.server.cjs.map +1 -1
- package/dist/index.server.d.cts +25 -39
- package/dist/index.server.d.cts.map +1 -1
- package/dist/index.server.d.mts +25 -39
- package/dist/index.server.d.mts.map +1 -1
- package/dist/index.server.mjs +50 -504
- package/dist/index.server.mjs.map +1 -1
- package/dist/index.types.cjs +105 -102
- package/dist/index.types.cjs.map +1 -1
- package/dist/index.types.d.cts +22 -38
- package/dist/index.types.d.cts.map +1 -1
- package/dist/index.types.d.mts +22 -38
- package/dist/index.types.d.mts.map +1 -1
- package/dist/index.types.mjs +102 -73
- package/dist/index.types.mjs.map +1 -1
- package/package.json +6 -20
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,197 @@
|
|
|
1
1
|
# gt-react
|
|
2
2
|
|
|
3
|
+
## 11.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#1816](https://github.com/generaltranslation/gt/pull/1816) [`463a8db`](https://github.com/generaltranslation/gt/commit/463a8dbb03bde35f2f229dfdabfe117197d4527b) Thanks [@bgub](https://github.com/bgub)! - Add a config-aware `resolveCanonicalLocale` helper and remove the public `getGTClass` helper.
|
|
8
|
+
|
|
9
|
+
- [#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.
|
|
10
|
+
|
|
11
|
+
- [#1816](https://github.com/generaltranslation/gt/pull/1816) [`463a8db`](https://github.com/generaltranslation/gt/commit/463a8dbb03bde35f2f229dfdabfe117197d4527b) Thanks [@bgub](https://github.com/bgub)! - Remove the deprecated `useGTClass` hook from public entry points.
|
|
12
|
+
|
|
13
|
+
- [#1821](https://github.com/generaltranslation/gt/pull/1821) [`40db0c5`](https://github.com/generaltranslation/gt/commit/40db0c54a58e82d693d8a16d19fe5071baabecdc) Thanks [@bgub](https://github.com/bgub)! - Remove `useVersionId` from public package entrypoints.
|
|
14
|
+
|
|
15
|
+
The `getVersionId` helper remains available from public function entrypoints and `gt-i18n/internal`.
|
|
16
|
+
|
|
17
|
+
- [#1439](https://github.com/generaltranslation/gt/pull/1439) [`8a2f7ee`](https://github.com/generaltranslation/gt/commit/8a2f7ee79f4b890fb1aaf47f42bb844334899793) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - Simplify translation option types. Replace deprecated inline and dictionary option aliases with `GTTranslationOptions`, use interpolation variables for dictionary `t()` options, and trim higher-level type exports to avoid exposing internal translation option fields.
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [#1439](https://github.com/generaltranslation/gt/pull/1439) [`37e0080`](https://github.com/generaltranslation/gt/commit/37e0080b2c072840cf6c0f1c66a8f0f3a54e17e5) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - Add default form and accessibility labels to LocaleSelector.
|
|
22
|
+
|
|
23
|
+
- [#1439](https://github.com/generaltranslation/gt/pull/1439) [`5bfd0a7`](https://github.com/generaltranslation/gt/commit/5bfd0a73e286bf76ae26f9178171aeca1c53ecc5) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - Preserve browser locale cookie updates when changing locales.
|
|
24
|
+
|
|
25
|
+
- [#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.
|
|
26
|
+
|
|
27
|
+
- [#1815](https://github.com/generaltranslation/gt/pull/1815) [`1212135`](https://github.com/generaltranslation/gt/commit/1212135e4e09ed754756cac2805bc3a139408dc1) Thanks [@bgub](https://github.com/bgub)! - Clean up the `@generaltranslation/react-core` public API surface.
|
|
28
|
+
- `@generaltranslation/react-core`: Removed dead dictionary helper exports and source files, stopped exporting JSX serialization internals from `/pure`, dropped internal singleton/plumbing exports from `/pure`, removed `useShouldTranslate` from `/hooks`, and kept only `internalInitializeGTSRA` for the server-rendered initializer.
|
|
29
|
+
- `gt-react`: Aliases `internalInitializeGTSRA` locally from the RSC entrypoint so the public `initializeGT` export remains unchanged.
|
|
30
|
+
- `gt-next`: Replaced imports of removed react-core legacy types with equivalent local types.
|
|
31
|
+
|
|
32
|
+
- [#1439](https://github.com/generaltranslation/gt/pull/1439) [`bd52e5e`](https://github.com/generaltranslation/gt/commit/bd52e5ef3fb38a63d9bac8a4af08ff93402c0749) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - Allow client i18n cache expiry to default to no expiry while preserving explicit cache expiry configuration.
|
|
33
|
+
|
|
34
|
+
- [#1439](https://github.com/generaltranslation/gt/pull/1439) [`8d2e84e`](https://github.com/generaltranslation/gt/commit/8d2e84e5083bb740815004bec90eaa341be7aff5) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - Preserve enableI18n hydration state from server props and request cookies.
|
|
35
|
+
|
|
36
|
+
- [#1439](https://github.com/generaltranslation/gt/pull/1439) [`04b5064`](https://github.com/generaltranslation/gt/commit/04b50645675abb9e927a82056b249b50f0907fcc) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - Restore namespace scoping for getTranslations and server useTranslations.
|
|
37
|
+
|
|
38
|
+
- [#1439](https://github.com/generaltranslation/gt/pull/1439) [`4335432`](https://github.com/generaltranslation/gt/commit/43354326beb16e13784b0c82faad447768bb8404) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - Use the shared runtime environment helper for browser cache dev-mode checks so `gt-react` typechecks without Vite ambient types.
|
|
39
|
+
|
|
40
|
+
- [#1828](https://github.com/generaltranslation/gt/pull/1828) [`04c285c`](https://github.com/generaltranslation/gt/commit/04c285c7b44f5404918cd4c80336dddf412472e9) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - Fix shipped types for the initializeGT export.
|
|
41
|
+
|
|
42
|
+
- [#1439](https://github.com/generaltranslation/gt/pull/1439) [`947fe0c`](https://github.com/generaltranslation/gt/commit/947fe0c97a2821a0980cd3e779252ea0078e80f8) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - Fix `useVersionId()` throwing and `useLocaleDirection()` requiring a locale argument in the client and server entrypoints.
|
|
43
|
+
|
|
44
|
+
`useVersionId()` now returns the current version id (instead of throwing the react-core "not implemented" error), and `useLocaleDirection()` once again accepts an optional locale that defaults to the current locale. The shared implementation now lives in `@generaltranslation/react-core/hooks`, so `gt-react` and `gt-react-native` use the same behavior; the RSC entrypoint keeps its stricter signatures.
|
|
45
|
+
|
|
46
|
+
- [#1439](https://github.com/generaltranslation/gt/pull/1439) [`e026c42`](https://github.com/generaltranslation/gt/commit/e026c42bc137e9865b548daee7238e6a458a5662) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - Add default form and accessibility labels to RegionSelector.
|
|
47
|
+
|
|
48
|
+
- [#1820](https://github.com/generaltranslation/gt/pull/1820) [`1f53e42`](https://github.com/generaltranslation/gt/commit/1f53e420e9a6475f85cf27e1cd0c9c89f4beeb36) Thanks [@bgub](https://github.com/bgub)! - Clean up the `gt-i18n` public API surface by removing dead subpaths, internal exports, and unused types.
|
|
49
|
+
|
|
50
|
+
- [#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.
|
|
51
|
+
- `gt-i18n`: Removed the unused React locale cookie name from the shared GT config type.
|
|
52
|
+
- `@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.
|
|
53
|
+
- `gt-next`: Imports default cookie names from the React Core `pure` entrypoint instead of the removed React Core cookie constants subpath.
|
|
54
|
+
- `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.
|
|
55
|
+
- `gt-react-native`: Native condition storage now resolves its store keys from `I18nConfig`, matching `gt-react` behavior.
|
|
56
|
+
- `gt-tanstack-start`: `parseLocale()` reads and writes the locale cookie using the configured cookie name instead of the default.
|
|
57
|
+
|
|
58
|
+
- [#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.
|
|
59
|
+
|
|
60
|
+
- [#1817](https://github.com/generaltranslation/gt/pull/1817) [`7744c55`](https://github.com/generaltranslation/gt/commit/7744c557d37c85ce3626681410cc0cd622374ecf) Thanks [@bgub](https://github.com/bgub)! - Remove RSC-only render internals from the `gt-react` react-server entry while keeping the compiler-injected internal translation exports available. The react-server declaration surface now also includes `RenderPipeline` and `RenderPreparedT`, matching the other `gt-react` entries.
|
|
61
|
+
|
|
62
|
+
- [#1439](https://github.com/generaltranslation/gt/pull/1439) [`97dc7f4`](https://github.com/generaltranslation/gt/commit/97dc7f4818476a319a54b1519e994a62d5a9a3a5) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - Remove default exports from package entrypoints and internal source modules.
|
|
63
|
+
|
|
64
|
+
Use named imports for affected public entrypoints, including `import { plugin } from 'gt-react-native/plugin'`. The `gt-next/link` entrypoint keeps its default export to match `next/link`.
|
|
65
|
+
|
|
66
|
+
- [#1439](https://github.com/generaltranslation/gt/pull/1439) [`85a0c19`](https://github.com/generaltranslation/gt/commit/85a0c1998a6500233affd8c1987551170584c782) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - Remove the deprecated `internalInitializeGTSPA` export from `@generaltranslation/react-core/pure` and the downstream `gt-react` server/types surfaces. Use `initializeGTSPA` from `gt-react` for browser SPA initialization.
|
|
67
|
+
|
|
68
|
+
- [#1439](https://github.com/generaltranslation/gt/pull/1439) [`c5364f9`](https://github.com/generaltranslation/gt/commit/c5364f977ffb4b387ad39206e6ed626bbeec56f3) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - Slim the i18n cache event surface by replacing the generic EventEmitter base class with a single cache-miss listener and removing unused cache helper methods.
|
|
69
|
+
|
|
70
|
+
- [#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.
|
|
71
|
+
Allow React i18n config checks to work across bundled react-core entrypoints.
|
|
72
|
+
|
|
73
|
+
- [#1439](https://github.com/generaltranslation/gt/pull/1439) [`2ca78ec`](https://github.com/generaltranslation/gt/commit/2ca78ec4805639c10c7b200c8dee660b55eddf15) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - Read Vite runtime credentials during React initialization while keeping dev API keys out of production bundles.
|
|
74
|
+
|
|
75
|
+
- [#1439](https://github.com/generaltranslation/gt/pull/1439) [`195f009`](https://github.com/generaltranslation/gt/commit/195f00910c2a675a6f9da327e19e3d3c5e44e26b) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - fix: make singleton not-initialized errors consistent and descriptive, and stop error paths from masking the original failure when I18nConfig is also uninitialized
|
|
76
|
+
|
|
77
|
+
- Updated dependencies [[`463a8db`](https://github.com/generaltranslation/gt/commit/463a8dbb03bde35f2f229dfdabfe117197d4527b), [`37e0080`](https://github.com/generaltranslation/gt/commit/37e0080b2c072840cf6c0f1c66a8f0f3a54e17e5), [`8870496`](https://github.com/generaltranslation/gt/commit/88704963eb74e81401994681ce7cdae3ba91b6c0), [`1212135`](https://github.com/generaltranslation/gt/commit/1212135e4e09ed754756cac2805bc3a139408dc1), [`04f419d`](https://github.com/generaltranslation/gt/commit/04f419d65e69db3eb4adb8ee6299c0ddee153135), [`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), [`04b5064`](https://github.com/generaltranslation/gt/commit/04b50645675abb9e927a82056b249b50f0907fcc), [`947fe0c`](https://github.com/generaltranslation/gt/commit/947fe0c97a2821a0980cd3e779252ea0078e80f8), [`5adeede`](https://github.com/generaltranslation/gt/commit/5adeede157922d547a33a078d0f527f572c9a8b4), [`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), [`88f3a2e`](https://github.com/generaltranslation/gt/commit/88f3a2e0f304fdd19891afac0b41954edc9497c6), [`e12fb17`](https://github.com/generaltranslation/gt/commit/e12fb17d41cfa5fa231e64fe70423434739ea985), [`44bc998`](https://github.com/generaltranslation/gt/commit/44bc998abf813ea4a96ade6c2632e1143034bd45), [`5752fe8`](https://github.com/generaltranslation/gt/commit/5752fe81bf5b5deaae878638e0de99959bf719be), [`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)]:
|
|
78
|
+
- gt-i18n@1.0.0
|
|
79
|
+
- @generaltranslation/react-core@11.0.0
|
|
80
|
+
- generaltranslation@9.0.0
|
|
81
|
+
- @generaltranslation/format@0.1.2
|
|
82
|
+
- @generaltranslation/supported-locales@2.1.2
|
|
83
|
+
|
|
84
|
+
## 11.0.0-odysseus.16
|
|
85
|
+
|
|
86
|
+
### Major Changes
|
|
87
|
+
|
|
88
|
+
- 463a8db: Add a config-aware `resolveCanonicalLocale` helper and remove the public `getGTClass` helper.
|
|
89
|
+
- 463a8db: Remove the deprecated `useGTClass` hook from public entry points.
|
|
90
|
+
- 40db0c5: Remove `useVersionId` from public package entrypoints.
|
|
91
|
+
|
|
92
|
+
The `getVersionId` helper remains available from public function entrypoints and `gt-i18n/internal`.
|
|
93
|
+
|
|
94
|
+
### Patch Changes
|
|
95
|
+
|
|
96
|
+
- 1f53e42: Clean up the `gt-i18n` public API surface by removing dead subpaths, internal exports, and unused types.
|
|
97
|
+
- 7744c55: Remove RSC-only render internals from the `gt-react` react-server entry while keeping the compiler-injected internal translation exports available. The react-server declaration surface now also includes `RenderPipeline` and `RenderPreparedT`, matching the other `gt-react` entries.
|
|
98
|
+
- Updated dependencies [463a8db]
|
|
99
|
+
- Updated dependencies [b72c30b]
|
|
100
|
+
- Updated dependencies [bea8233]
|
|
101
|
+
- Updated dependencies [5736d58]
|
|
102
|
+
- Updated dependencies [1f53e42]
|
|
103
|
+
- Updated dependencies [463a8db]
|
|
104
|
+
- Updated dependencies [e343775]
|
|
105
|
+
- Updated dependencies [40db0c5]
|
|
106
|
+
- Updated dependencies [d5cf2d3]
|
|
107
|
+
- gt-i18n@1.0.0-odysseus.9
|
|
108
|
+
- @generaltranslation/react-core@11.0.0-odysseus.16
|
|
109
|
+
- generaltranslation@9.0.0-odysseus.6
|
|
110
|
+
- @generaltranslation/supported-locales@2.1.2-odysseus.6
|
|
111
|
+
|
|
112
|
+
## 11.0.0-odysseus.15
|
|
113
|
+
|
|
114
|
+
### Patch Changes
|
|
115
|
+
|
|
116
|
+
- 8d2e84e: Preserve enableI18n hydration state from server props and request cookies.
|
|
117
|
+
- c5364f9: Slim the i18n cache event surface by replacing the generic EventEmitter base class with a single cache-miss listener and removing unused cache helper methods.
|
|
118
|
+
- 195f009: fix: make singleton not-initialized errors consistent and descriptive, and stop error paths from masking the original failure when I18nConfig is also uninitialized
|
|
119
|
+
- Updated dependencies [04f419d]
|
|
120
|
+
- Updated dependencies [72e9e16]
|
|
121
|
+
- Updated dependencies [42a440f]
|
|
122
|
+
- Updated dependencies [5adeede]
|
|
123
|
+
- Updated dependencies [c5364f9]
|
|
124
|
+
- Updated dependencies [2e85ebd]
|
|
125
|
+
- Updated dependencies [195f009]
|
|
126
|
+
- @generaltranslation/react-core@11.0.0-odysseus.15
|
|
127
|
+
- generaltranslation@9.0.0-odysseus.5
|
|
128
|
+
- gt-i18n@1.0.0-odysseus.8
|
|
129
|
+
- @generaltranslation/supported-locales@2.1.2-odysseus.5
|
|
130
|
+
|
|
131
|
+
## 11.0.0-odysseus.14
|
|
132
|
+
|
|
133
|
+
### Patch Changes
|
|
134
|
+
|
|
135
|
+
- 0cd7813: Store cookie names in I18nConfig so custom cookie names work before the condition store is initialized.
|
|
136
|
+
- `gt-i18n`: Removed the unused React locale cookie name from the shared GT config type.
|
|
137
|
+
- `@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.
|
|
138
|
+
- `gt-next`: Imports default cookie names from the React Core `pure` entrypoint instead of the removed React Core cookie constants subpath.
|
|
139
|
+
- `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.
|
|
140
|
+
- `gt-react-native`: Native condition storage now resolves its store keys from `I18nConfig`, matching `gt-react` behavior.
|
|
141
|
+
- `gt-tanstack-start`: `parseLocale()` reads and writes the locale cookie using the configured cookie name instead of the default.
|
|
142
|
+
|
|
143
|
+
- Updated dependencies [ab61565]
|
|
144
|
+
- Updated dependencies [0cd7813]
|
|
145
|
+
- gt-i18n@1.0.0-odysseus.7
|
|
146
|
+
- @generaltranslation/react-core@11.0.0-odysseus.14
|
|
147
|
+
|
|
148
|
+
## 11.0.0-odysseus.13
|
|
149
|
+
|
|
150
|
+
### Patch Changes
|
|
151
|
+
|
|
152
|
+
- a2b9677: Restore namespace scoping for getTranslations and server useTranslations.
|
|
153
|
+
- 41371e0: Read Vite runtime credentials during React initialization while keeping dev API keys out of production bundles.
|
|
154
|
+
- Updated dependencies [a2b9677]
|
|
155
|
+
- Updated dependencies [41371e0]
|
|
156
|
+
- gt-i18n@1.0.0-odysseus.6
|
|
157
|
+
- @generaltranslation/react-core@11.0.0-odysseus.13
|
|
158
|
+
|
|
159
|
+
## 11.0.0-odysseus.12
|
|
160
|
+
|
|
161
|
+
### Patch Changes
|
|
162
|
+
|
|
163
|
+
- Updated dependencies [7be23bc]
|
|
164
|
+
- @generaltranslation/react-core@11.0.0-odysseus.12
|
|
165
|
+
|
|
166
|
+
## 11.0.0-odysseus.11
|
|
167
|
+
|
|
168
|
+
### Patch Changes
|
|
169
|
+
|
|
170
|
+
- @generaltranslation/react-core@11.0.0-odysseus.11
|
|
171
|
+
|
|
172
|
+
## 11.0.0-odysseus.10
|
|
173
|
+
|
|
174
|
+
### Patch Changes
|
|
175
|
+
|
|
176
|
+
- 07f74f0: Clean up stale package metadata and align TanStack Start package entry points.
|
|
177
|
+
- ee34fea: Use the shared runtime environment helper for browser cache dev-mode checks so `gt-react` typechecks without Vite ambient types.
|
|
178
|
+
- bcba6fd: Fix `useVersionId()` throwing and `useLocaleDirection()` requiring a locale argument in the client and server entrypoints.
|
|
179
|
+
|
|
180
|
+
`useVersionId()` now returns the current version id (instead of throwing the react-core "not implemented" error), and `useLocaleDirection()` once again accepts an optional locale that defaults to the current locale. The shared implementation now lives in `@generaltranslation/react-core/hooks`, so `gt-react` and `gt-react-native` use the same behavior; the RSC entrypoint keeps its stricter signatures.
|
|
181
|
+
|
|
182
|
+
- 288c9f8: Remove the deprecated `internalInitializeGTSPA` export from `@generaltranslation/react-core/pure` and the downstream `gt-react` server/types surfaces. Use `initializeGTSPA` from `gt-react` for browser SPA initialization.
|
|
183
|
+
- Updated dependencies [432fa49]
|
|
184
|
+
- Updated dependencies [432fa49]
|
|
185
|
+
- Updated dependencies [bcba6fd]
|
|
186
|
+
- Updated dependencies [933916e]
|
|
187
|
+
- Updated dependencies [b7b3eaf]
|
|
188
|
+
- Updated dependencies [dfb5fc9]
|
|
189
|
+
- Updated dependencies [4a5f8e8]
|
|
190
|
+
- Updated dependencies [288c9f8]
|
|
191
|
+
- Updated dependencies [083d306]
|
|
192
|
+
- gt-i18n@1.0.0-odysseus.5
|
|
193
|
+
- @generaltranslation/react-core@11.0.0-odysseus.10
|
|
194
|
+
|
|
3
195
|
## 11.0.0-odysseus.9
|
|
4
196
|
|
|
5
197
|
### Patch Changes
|
|
@@ -154,6 +346,68 @@
|
|
|
154
346
|
|
|
155
347
|
### Patch Changes
|
|
156
348
|
|
|
349
|
+
- Updated dependencies [[`cc4edc1`](https://github.com/generaltranslation/gt/commit/cc4edc1e40d9977125bf6d053fb7f8cdbdd40b05)]:
|
|
350
|
+
- @generaltranslation/supported-locales@2.1.0
|
|
351
|
+
- gt-i18n@0.9.4
|
|
352
|
+
- @generaltranslation/react-core@1.8.20
|
|
353
|
+
|
|
354
|
+
## 10.20.5
|
|
355
|
+
|
|
356
|
+
### Patch Changes
|
|
357
|
+
|
|
358
|
+
- Updated dependencies [[`6945a98`](https://github.com/generaltranslation/gt/commit/6945a9871ea260dd999dcb2246c48b21134721f6)]:
|
|
359
|
+
- @generaltranslation/react-core@1.8.25
|
|
360
|
+
- generaltranslation@8.2.19
|
|
361
|
+
- gt-i18n@0.9.9
|
|
362
|
+
- @generaltranslation/supported-locales@2.1.5
|
|
363
|
+
|
|
364
|
+
## 10.20.4
|
|
365
|
+
|
|
366
|
+
### Patch Changes
|
|
367
|
+
|
|
368
|
+
- Updated dependencies [[`a2a3dd0`](https://github.com/generaltranslation/gt/commit/a2a3dd0bcdce9abe360c406a12fc6bb3bc3ca181)]:
|
|
369
|
+
- @generaltranslation/supported-locales@2.1.4
|
|
370
|
+
- gt-i18n@0.9.8
|
|
371
|
+
- @generaltranslation/react-core@1.8.24
|
|
372
|
+
|
|
373
|
+
## 10.20.3
|
|
374
|
+
|
|
375
|
+
### Patch Changes
|
|
376
|
+
|
|
377
|
+
- Updated dependencies [[`9709a2f`](https://github.com/generaltranslation/gt/commit/9709a2f2b97b9d8239298e39bb31e57692bbffd8)]:
|
|
378
|
+
- generaltranslation@8.2.18
|
|
379
|
+
- gt-i18n@0.9.7
|
|
380
|
+
- @generaltranslation/react-core@1.8.23
|
|
381
|
+
- @generaltranslation/supported-locales@2.1.3
|
|
382
|
+
|
|
383
|
+
## 10.20.2
|
|
384
|
+
|
|
385
|
+
### Patch Changes
|
|
386
|
+
|
|
387
|
+
- Updated dependencies [[`3197028`](https://github.com/generaltranslation/gt/commit/319702855a7b129f95217d41be9f2402680a2f01)]:
|
|
388
|
+
- generaltranslation@8.2.17
|
|
389
|
+
- gt-i18n@0.9.6
|
|
390
|
+
- @generaltranslation/react-core@1.8.22
|
|
391
|
+
- @generaltranslation/supported-locales@2.1.2
|
|
392
|
+
|
|
393
|
+
## 10.20.1
|
|
394
|
+
|
|
395
|
+
## 10.20.0
|
|
396
|
+
|
|
397
|
+
## 10.19.19
|
|
398
|
+
|
|
399
|
+
### Patch Changes
|
|
400
|
+
|
|
401
|
+
- Updated dependencies [[`e041312`](https://github.com/generaltranslation/gt/commit/e04131263dd61e469db977bcc196dc1283e773d0)]:
|
|
402
|
+
- generaltranslation@8.2.16
|
|
403
|
+
- gt-i18n@0.9.5
|
|
404
|
+
- @generaltranslation/react-core@1.8.21
|
|
405
|
+
- @generaltranslation/supported-locales@2.1.1
|
|
406
|
+
|
|
407
|
+
## 10.19.18
|
|
408
|
+
|
|
409
|
+
### Patch Changes
|
|
410
|
+
|
|
157
411
|
- Updated dependencies [[`cc4edc1`](https://github.com/generaltranslation/gt/commit/cc4edc1e40d9977125bf6d053fb7f8cdbdd40b05)]:
|
|
158
412
|
- @generaltranslation/supported-locales@2.1.0
|
|
159
413
|
- gt-i18n@0.9.4
|
package/dist/index.client.cjs
CHANGED
|
@@ -201,7 +201,7 @@ function deleteExpiredEntries(cache, now = Date.now()) {
|
|
|
201
201
|
for (const key of Object.keys(cache)) if (cache[key].exp <= now) delete cache[key];
|
|
202
202
|
}
|
|
203
203
|
//#endregion
|
|
204
|
-
//#region ../core/dist/
|
|
204
|
+
//#region ../core/dist/api-BOEGbEF6.mjs
|
|
205
205
|
function ensureSentence(text) {
|
|
206
206
|
const trimmed = text.trim();
|
|
207
207
|
if (!trimmed) return "";
|
|
@@ -265,7 +265,7 @@ var BrowserI18nCache = class extends gt_i18n_internal.I18nCache {
|
|
|
265
265
|
...DEFAULT_HTML_TAG_OPTIONS,
|
|
266
266
|
...htmlTagOptions
|
|
267
267
|
};
|
|
268
|
-
if (devHotReloadEnabled) this.
|
|
268
|
+
if (devHotReloadEnabled) this.onTranslationsCacheMiss = ({ locale, hash, translation }) => {
|
|
269
269
|
const cache = localStorageCaches[locale];
|
|
270
270
|
if (cache) cache.write(hash, translation);
|
|
271
271
|
else localStorageCaches[locale] = new LocalStorageTranslationCache({
|
|
@@ -273,7 +273,7 @@ var BrowserI18nCache = class extends gt_i18n_internal.I18nCache {
|
|
|
273
273
|
projectId,
|
|
274
274
|
init: { [hash]: translation }
|
|
275
275
|
});
|
|
276
|
-
}
|
|
276
|
+
};
|
|
277
277
|
}
|
|
278
278
|
/**
|
|
279
279
|
* Whether dev hot reload JSX (Suspense-based <T>) is active
|
|
@@ -287,7 +287,7 @@ var BrowserI18nCache = class extends gt_i18n_internal.I18nCache {
|
|
|
287
287
|
* Returns undefined if not in development mode.
|
|
288
288
|
*/
|
|
289
289
|
getLocalStorageTranslationCache(locale, init) {
|
|
290
|
-
if (
|
|
290
|
+
if ((0, gt_i18n_internal.getRuntimeEnvironment)() !== "development") return void 0;
|
|
291
291
|
if (!this._localStorageCaches[locale]) this._localStorageCaches[locale] = new LocalStorageTranslationCache({
|
|
292
292
|
locale,
|
|
293
293
|
projectId: this.config.projectId,
|
|
@@ -375,27 +375,6 @@ function readBrowserLocale(localeCookieName) {
|
|
|
375
375
|
return candidates;
|
|
376
376
|
}
|
|
377
377
|
//#endregion
|
|
378
|
-
//#region src/cookie-names.ts
|
|
379
|
-
/**
|
|
380
|
-
* Cookie name for tracking the user's selected locale.
|
|
381
|
-
*/
|
|
382
|
-
const defaultLocaleCookieName = "generaltranslation.locale";
|
|
383
|
-
/**
|
|
384
|
-
* Cookie name for tracking the user's selected region.
|
|
385
|
-
*/
|
|
386
|
-
const defaultRegionCookieName = "generaltranslation.region";
|
|
387
|
-
/**
|
|
388
|
-
* Cookie name for persisting the enableI18n feature flag.
|
|
389
|
-
*/
|
|
390
|
-
const defaultEnableI18nCookieName = "generaltranslation.enable-i18n";
|
|
391
|
-
/**
|
|
392
|
-
* Cookie name for tracking the locale reset
|
|
393
|
-
* Used by gt-next middleware
|
|
394
|
-
*
|
|
395
|
-
* TODO: remove this cookie when come up with better solution
|
|
396
|
-
*/
|
|
397
|
-
const defaultResetLocaleCookieName = "generaltranslation.locale-reset";
|
|
398
|
-
//#endregion
|
|
399
378
|
//#region src/condition-store/BrowserConditionStore.ts
|
|
400
379
|
/**
|
|
401
380
|
* Condition store implementation for Browser.
|
|
@@ -403,18 +382,18 @@ const defaultResetLocaleCookieName = "generaltranslation.locale-reset";
|
|
|
403
382
|
var BrowserConditionStore = class {
|
|
404
383
|
constructor(config) {
|
|
405
384
|
this.getLocale = () => {
|
|
406
|
-
return getBrowserLocale(this.
|
|
385
|
+
return getBrowserLocale(this.customGetLocale);
|
|
407
386
|
};
|
|
408
387
|
this.setLocale = (locale) => {
|
|
409
388
|
this.updateLocale(locale);
|
|
410
389
|
setCookieValue({
|
|
411
|
-
cookieName: defaultResetLocaleCookieName,
|
|
390
|
+
cookieName: _generaltranslation_react_core_pure.defaultResetLocaleCookieName,
|
|
412
391
|
value: "true"
|
|
413
392
|
});
|
|
414
393
|
this.reload();
|
|
415
394
|
};
|
|
416
395
|
this.getRegion = () => {
|
|
417
|
-
const cookieRegion = getCookieValue({ cookieName:
|
|
396
|
+
const cookieRegion = getCookieValue({ cookieName: (0, _generaltranslation_react_core_pure.getI18nConfig)().getRegionCookieName() });
|
|
418
397
|
if (cookieRegion) return cookieRegion;
|
|
419
398
|
return this.customGetRegion?.();
|
|
420
399
|
};
|
|
@@ -423,7 +402,7 @@ var BrowserConditionStore = class {
|
|
|
423
402
|
this.reload();
|
|
424
403
|
};
|
|
425
404
|
this.getEnableI18n = () => {
|
|
426
|
-
const cookieEnableI18n = getCookieValue({ cookieName:
|
|
405
|
+
const cookieEnableI18n = getCookieValue({ cookieName: (0, _generaltranslation_react_core_pure.getI18nConfig)().getEnableI18nCookieName() });
|
|
427
406
|
if (cookieEnableI18n === void 0) return this.customGetEnableI18n?.() ?? true;
|
|
428
407
|
return cookieEnableI18n === "true";
|
|
429
408
|
};
|
|
@@ -432,21 +411,21 @@ var BrowserConditionStore = class {
|
|
|
432
411
|
this.reload();
|
|
433
412
|
};
|
|
434
413
|
this.updateLocale = (locale) => {
|
|
435
|
-
const i18nConfig = (0,
|
|
414
|
+
const i18nConfig = (0, _generaltranslation_react_core_pure.getI18nConfig)();
|
|
436
415
|
setCookieValue({
|
|
437
|
-
cookieName:
|
|
438
|
-
value: i18nConfig.
|
|
416
|
+
cookieName: i18nConfig.getLocaleCookieName(),
|
|
417
|
+
value: i18nConfig.resolveSupportedLocale(locale)
|
|
439
418
|
});
|
|
440
419
|
};
|
|
441
420
|
this.updateRegion = (region) => {
|
|
442
421
|
setCookieValue({
|
|
443
|
-
cookieName:
|
|
422
|
+
cookieName: (0, _generaltranslation_react_core_pure.getI18nConfig)().getRegionCookieName(),
|
|
444
423
|
value: region ?? ""
|
|
445
424
|
});
|
|
446
425
|
};
|
|
447
426
|
this.updateEnableI18n = (enableI18n) => {
|
|
448
427
|
setCookieValue({
|
|
449
|
-
cookieName:
|
|
428
|
+
cookieName: (0, _generaltranslation_react_core_pure.getI18nConfig)().getEnableI18nCookieName(),
|
|
450
429
|
value: enableI18n ? "true" : "false"
|
|
451
430
|
});
|
|
452
431
|
};
|
|
@@ -458,35 +437,39 @@ var BrowserConditionStore = class {
|
|
|
458
437
|
};
|
|
459
438
|
this.customReload(state);
|
|
460
439
|
};
|
|
440
|
+
const i18nConfig = (0, _generaltranslation_react_core_pure.getI18nConfig)();
|
|
461
441
|
this.customReload = config._reload ?? (() => typeof window !== "undefined" ? window.location.reload() : void 0);
|
|
462
442
|
this.customGetLocale = config._getLocale;
|
|
463
443
|
this.customGetRegion = config._getRegion;
|
|
464
444
|
this.customGetEnableI18n = config._getEnableI18n;
|
|
465
|
-
this.localeCookieName = config.localeCookieName ?? "generaltranslation.locale";
|
|
466
|
-
this.regionCookieName = config.regionCookieName ?? "generaltranslation.region";
|
|
467
|
-
this.enableI18nCookieName = config.enableI18nCookieName ?? "generaltranslation.enable-i18n";
|
|
468
|
-
const i18nConfig = (0, gt_i18n_internal.getI18nConfig)();
|
|
469
445
|
setCookieValue({
|
|
470
|
-
cookieName:
|
|
471
|
-
value: i18nConfig.
|
|
446
|
+
cookieName: i18nConfig.getLocaleCookieName(),
|
|
447
|
+
value: i18nConfig.resolveSupportedLocale(config.locale)
|
|
472
448
|
});
|
|
473
449
|
if (config.region !== void 0) setCookieValue({
|
|
474
|
-
cookieName:
|
|
450
|
+
cookieName: i18nConfig.getRegionCookieName(),
|
|
475
451
|
value: config.region
|
|
476
452
|
});
|
|
477
453
|
this.updateEnableI18n(config.enableI18n ?? true);
|
|
478
454
|
}
|
|
479
455
|
};
|
|
480
|
-
function getBrowserLocale(
|
|
481
|
-
const
|
|
456
|
+
function getBrowserLocale(getLocale) {
|
|
457
|
+
const i18nConfig = (0, _generaltranslation_react_core_pure.getI18nConfig)();
|
|
458
|
+
const candidates = readBrowserLocale(i18nConfig.getLocaleCookieName());
|
|
482
459
|
if (getLocale) candidates.push(getLocale());
|
|
483
|
-
|
|
484
|
-
return i18nConfig.determineLocale(candidates) || i18nConfig.getDefaultLocale();
|
|
460
|
+
return i18nConfig.resolveSupportedLocale(candidates);
|
|
485
461
|
}
|
|
486
462
|
//#endregion
|
|
487
463
|
//#region src/condition-store/singleton-operations.ts
|
|
488
|
-
const
|
|
489
|
-
|
|
464
|
+
const conditionStoreNotInitializedError = createDiagnosticMessage({
|
|
465
|
+
source: "gt-react",
|
|
466
|
+
severity: "Error",
|
|
467
|
+
whatHappened: "Cannot read GT runtime context before it has been initialized",
|
|
468
|
+
why: "the internal ConditionStore singleton is unavailable",
|
|
469
|
+
fix: "Call initializeGT() (or initializeGTSPA() in SPA apps) before rendering and add a <GTProvider> at the root of your component tree."
|
|
470
|
+
});
|
|
471
|
+
const { setConditionStore: setReadonlyConditionStore, isConditionStoreInitialized: isReadonlyConditionStoreInitialized } = (0, gt_i18n_internal.createConditionStoreSingleton)(conditionStoreNotInitializedError);
|
|
472
|
+
const { getConditionStore: getBrowserConditionStore, setConditionStore: setBrowserConditionStore, isConditionStoreInitialized: isBrowserConditionStoreInitialized } = (0, gt_i18n_internal.createConditionStoreSingleton)(conditionStoreNotInitializedError);
|
|
490
473
|
//#endregion
|
|
491
474
|
//#region src/condition-store/createBrowserConditionStore.ts
|
|
492
475
|
/**
|
|
@@ -494,8 +477,11 @@ const { getConditionStore: getBrowserConditionStore, setConditionStore: setBrows
|
|
|
494
477
|
*
|
|
495
478
|
* This exists so we can keep the locale param as required in the constructor
|
|
496
479
|
*
|
|
497
|
-
*
|
|
498
|
-
*
|
|
480
|
+
* Server-provided props are the first candidates for hydration consistency.
|
|
481
|
+
* Cookies fill in missing values to persist state across page reloads.
|
|
482
|
+
*
|
|
483
|
+
* Cookie names come from the I18nConfig singleton so custom names passed to
|
|
484
|
+
* initializeGT() apply here without being threaded through provider props.
|
|
499
485
|
*/
|
|
500
486
|
function createOrUpdateBrowserConditionStore(config) {
|
|
501
487
|
const locale = determineLocale(config);
|
|
@@ -510,9 +496,6 @@ function createOrUpdateBrowserConditionStore(config) {
|
|
|
510
496
|
}
|
|
511
497
|
const conditionStore = new BrowserConditionStore({
|
|
512
498
|
...config,
|
|
513
|
-
localeCookieName: defaultLocaleCookieName,
|
|
514
|
-
regionCookieName: defaultRegionCookieName,
|
|
515
|
-
enableI18nCookieName: defaultEnableI18nCookieName,
|
|
516
499
|
locale,
|
|
517
500
|
region,
|
|
518
501
|
enableI18n
|
|
@@ -520,26 +503,64 @@ function createOrUpdateBrowserConditionStore(config) {
|
|
|
520
503
|
setBrowserConditionStore(conditionStore);
|
|
521
504
|
return conditionStore;
|
|
522
505
|
}
|
|
523
|
-
function determineLocale({
|
|
506
|
+
function determineLocale({ _getLocale: getLocale, locale }) {
|
|
507
|
+
const i18nConfig = (0, _generaltranslation_react_core_pure.getI18nConfig)();
|
|
524
508
|
const candidates = [];
|
|
525
509
|
if (locale) candidates.push(...Array.isArray(locale) ? locale : [locale]);
|
|
526
510
|
if (getLocale) candidates.push(getLocale());
|
|
527
|
-
candidates.push(...readBrowserLocale(
|
|
528
|
-
return
|
|
511
|
+
candidates.push(...readBrowserLocale(i18nConfig.getLocaleCookieName()));
|
|
512
|
+
return i18nConfig.resolveSupportedLocale(candidates);
|
|
529
513
|
}
|
|
530
|
-
function
|
|
531
|
-
|
|
532
|
-
return i18nConfig.determineLocale(candidates) || i18nConfig.getDefaultLocale();
|
|
514
|
+
function determineRegion({ _getRegion: getRegion, region }) {
|
|
515
|
+
return getCookieValue({ cookieName: (0, _generaltranslation_react_core_pure.getI18nConfig)().getRegionCookieName() }) || getRegion?.() || region;
|
|
533
516
|
}
|
|
534
|
-
function
|
|
535
|
-
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
const cookieEnableI18n = getCookieValue({ cookieName: enableI18nCookieName });
|
|
539
|
-
if (cookieEnableI18n === void 0) return getEnableI18n?.() ?? enableI18n ?? true;
|
|
517
|
+
function determineEnableI18n({ enableI18n, _getEnableI18n: getEnableI18n }) {
|
|
518
|
+
if (enableI18n !== void 0) return enableI18n;
|
|
519
|
+
const cookieEnableI18n = getCookieValue({ cookieName: (0, _generaltranslation_react_core_pure.getI18nConfig)().getEnableI18nCookieName() });
|
|
520
|
+
if (cookieEnableI18n === void 0) return getEnableI18n?.() ?? true;
|
|
540
521
|
return cookieEnableI18n === "true";
|
|
541
522
|
}
|
|
542
523
|
//#endregion
|
|
524
|
+
//#region src/setup/runtimeCredentials.ts
|
|
525
|
+
function addRuntimeCredentials(config) {
|
|
526
|
+
const credentials = getRuntimeCredentials();
|
|
527
|
+
return {
|
|
528
|
+
...config,
|
|
529
|
+
projectId: config.projectId || credentials.projectId,
|
|
530
|
+
devApiKey: config.devApiKey || credentials.devApiKey
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
function getRuntimeCredentials() {
|
|
534
|
+
return {
|
|
535
|
+
projectId: readImportMetaVite(() => ({}).env?.VITE_GT_PROJECT_ID) || readProcessEnvViteProjectId(),
|
|
536
|
+
devApiKey: (0, gt_i18n_internal.getRuntimeEnvironment)() === "development" ? readImportMetaVite(() => ({}).env?.DEV ? {}.env?.VITE_GT_DEV_API_KEY : void 0) || readProcessEnvViteDevApiKey() : void 0
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
function readImportMetaVite(readValue) {
|
|
540
|
+
try {
|
|
541
|
+
return normalizeEnvValue(readValue());
|
|
542
|
+
} catch {
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
function readProcessEnvViteProjectId() {
|
|
547
|
+
try {
|
|
548
|
+
return normalizeEnvValue(process.env.VITE_GT_PROJECT_ID);
|
|
549
|
+
} catch {
|
|
550
|
+
return;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
function readProcessEnvViteDevApiKey() {
|
|
554
|
+
try {
|
|
555
|
+
return normalizeEnvValue(process.env.VITE_GT_DEV_API_KEY);
|
|
556
|
+
} catch {
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
function normalizeEnvValue(value) {
|
|
561
|
+
return value || void 0;
|
|
562
|
+
}
|
|
563
|
+
//#endregion
|
|
543
564
|
//#region src/setup/initializeGTSPA.ts
|
|
544
565
|
/**
|
|
545
566
|
* Initialize GT for an SPA
|
|
@@ -550,12 +571,12 @@ function determineEnableI18n({ enableI18n, enableI18nCookieName = defaultEnableI
|
|
|
550
571
|
* This is SPA for browser runtime
|
|
551
572
|
*/
|
|
552
573
|
async function initializeGTSPA(config) {
|
|
553
|
-
|
|
554
|
-
(0, _generaltranslation_react_core_pure.initializeI18nConfig)(
|
|
555
|
-
(0, _generaltranslation_react_core_pure.setReactI18nCache)(new BrowserI18nCache(
|
|
556
|
-
createOrUpdateBrowserConditionStore(
|
|
574
|
+
const runtimeConfig = addRuntimeCredentials(config);
|
|
575
|
+
(0, _generaltranslation_react_core_pure.initializeI18nConfig)(runtimeConfig, "SPA");
|
|
576
|
+
(0, _generaltranslation_react_core_pure.setReactI18nCache)(new BrowserI18nCache(runtimeConfig));
|
|
577
|
+
createOrUpdateBrowserConditionStore(runtimeConfig);
|
|
557
578
|
(0, _generaltranslation_react_core_pure.setI18nStore)(new _generaltranslation_react_core_pure.I18nStore());
|
|
558
|
-
await (0, _generaltranslation_react_core_pure.getTranslationsSnapshot)((0, _generaltranslation_react_core_pure.
|
|
579
|
+
await (0, _generaltranslation_react_core_pure.getTranslationsSnapshot)((0, _generaltranslation_react_core_pure.getReadonlyConditionStore)().getLocale());
|
|
559
580
|
}
|
|
560
581
|
//#endregion
|
|
561
582
|
//#region src/setup/initializeGTSRAClient.ts
|
|
@@ -563,10 +584,10 @@ async function initializeGTSPA(config) {
|
|
|
563
584
|
* Initialize GT for client-side rendering.
|
|
564
585
|
*/
|
|
565
586
|
function initializeGTSRAClient(config) {
|
|
566
|
-
(0, _generaltranslation_react_core_pure.internalInitializeGTSRA)({
|
|
587
|
+
(0, _generaltranslation_react_core_pure.internalInitializeGTSRA)(addRuntimeCredentials({
|
|
567
588
|
cacheExpiryTime: null,
|
|
568
589
|
...config
|
|
569
|
-
});
|
|
590
|
+
}));
|
|
570
591
|
}
|
|
571
592
|
//#endregion
|
|
572
593
|
//#region src/hooks/conditions-store.ts
|
|
@@ -853,9 +874,6 @@ Object.defineProperty(exports, "decodeVars", {
|
|
|
853
874
|
return _generaltranslation_react_core_pure.decodeVars;
|
|
854
875
|
}
|
|
855
876
|
});
|
|
856
|
-
exports.defaultEnableI18nCookieName = defaultEnableI18nCookieName;
|
|
857
|
-
exports.defaultLocaleCookieName = defaultLocaleCookieName;
|
|
858
|
-
exports.defaultRegionCookieName = defaultRegionCookieName;
|
|
859
877
|
Object.defineProperty(exports, "derive", {
|
|
860
878
|
enumerable: true,
|
|
861
879
|
get: function() {
|
|
@@ -874,12 +892,6 @@ Object.defineProperty(exports, "getFormatLocales", {
|
|
|
874
892
|
return _generaltranslation_react_core_pure.getFormatLocales;
|
|
875
893
|
}
|
|
876
894
|
});
|
|
877
|
-
Object.defineProperty(exports, "getGTClass", {
|
|
878
|
-
enumerable: true,
|
|
879
|
-
get: function() {
|
|
880
|
-
return _generaltranslation_react_core_pure.getGTClass;
|
|
881
|
-
}
|
|
882
|
-
});
|
|
883
895
|
Object.defineProperty(exports, "getLocaleProperties", {
|
|
884
896
|
enumerable: true,
|
|
885
897
|
get: function() {
|
|
@@ -930,6 +942,12 @@ Object.defineProperty(exports, "msg", {
|
|
|
930
942
|
return _generaltranslation_react_core_pure.msg;
|
|
931
943
|
}
|
|
932
944
|
});
|
|
945
|
+
Object.defineProperty(exports, "resolveCanonicalLocale", {
|
|
946
|
+
enumerable: true,
|
|
947
|
+
get: function() {
|
|
948
|
+
return _generaltranslation_react_core_pure.resolveCanonicalLocale;
|
|
949
|
+
}
|
|
950
|
+
});
|
|
933
951
|
Object.defineProperty(exports, "setReactI18nCache", {
|
|
934
952
|
enumerable: true,
|
|
935
953
|
get: function() {
|
|
@@ -972,12 +990,6 @@ Object.defineProperty(exports, "useGT", {
|
|
|
972
990
|
return _generaltranslation_react_core_hooks.useGT;
|
|
973
991
|
}
|
|
974
992
|
});
|
|
975
|
-
Object.defineProperty(exports, "useGTClass", {
|
|
976
|
-
enumerable: true,
|
|
977
|
-
get: function() {
|
|
978
|
-
return _generaltranslation_react_core_hooks.useGTClass;
|
|
979
|
-
}
|
|
980
|
-
});
|
|
981
993
|
Object.defineProperty(exports, "useLocale", {
|
|
982
994
|
enumerable: true,
|
|
983
995
|
get: function() {
|
|
@@ -1025,11 +1037,5 @@ Object.defineProperty(exports, "useTranslations", {
|
|
|
1025
1037
|
return _generaltranslation_react_core_hooks.useTranslations;
|
|
1026
1038
|
}
|
|
1027
1039
|
});
|
|
1028
|
-
Object.defineProperty(exports, "useVersionId", {
|
|
1029
|
-
enumerable: true,
|
|
1030
|
-
get: function() {
|
|
1031
|
-
return _generaltranslation_react_core_hooks.useVersionId;
|
|
1032
|
-
}
|
|
1033
|
-
});
|
|
1034
1040
|
|
|
1035
1041
|
//# sourceMappingURL=index.client.cjs.map
|