feat(vue): add gt-vue package#1774
Conversation
## Summary
- add a react-server-specific types condition for gt-next's root export
- point the condition at `dist/index.rsc.d.ts` so RSC imports no longer
see client-only hooks from `index.types.d.ts`
- add a package export regression test
- add a gt-next patch changeset
## Tests
- pnpm --filter gt-next test -- src/__tests__/packageExports.test.ts
- pnpm --filter gt-next typecheck
- pnpm exec oxlint packages/next/src/__tests__/packageExports.test.ts
- pnpm exec oxfmt --check .changeset/gt-next-react-server-types.md
packages/next/package.json
packages/next/src/__tests__/packageExports.test.ts
- git diff --check
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR fixes incorrect TypeScript types being exposed when `gt-next` is
imported under the `react-server` export condition. By adding a
`"types"` field pointing at `dist/index.rsc.d.ts` inside the
`react-server` export block, TypeScript will now resolve RSC-specific
declarations instead of the general `index.types.d.ts` which includes
client-only hooks.
- **`packages/next/package.json`**: Inserts `"types":
"./dist/index.rsc.d.ts"` as the first key in the `react-server`
condition block, consistent with how other named conditions (e.g.
`./config`, `./server`) order their `types` field ahead of the runtime
entries.
- **`packages/next/src/__tests__/packageExports.test.ts`**: Adds a
regression test that reads `package.json` at test time and asserts both
the RSC-condition `types` path and the fallback `types` path, preventing
silent rollback of this fix.
- **`.changeset/gt-next-react-server-types.md`**: Records a `patch`
changeset describing the fix.
<details open><summary><h3>Confidence Score: 5/5</h3></summary>
Safe to merge — the change is a single-line addition to the exports map
that wires up an already-emitted declaration file, accompanied by a
targeted regression test.
The fix is minimal and mechanical: one new field in `package.json`, a
matching test, and a changeset. `src/index.rsc.ts` already exists and
`tsc --emitDeclarationOnly` will produce `dist/index.rsc.d.ts` as part
of the normal build, so the pointed-at file is not invented. The `types`
key is correctly placed before `import`/`default` inside the
`react-server` condition block, matching the ordering convention used
elsewhere in the exports map. No runtime behavior changes — only
TypeScript's view of the package changes for RSC consumers.
No files require special attention.
</details>
<details><summary><h3>Important Files Changed</h3></summary>
| Filename | Overview |
|----------|----------|
| packages/next/package.json | Adds `"types": "./dist/index.rsc.d.ts"`
as the first entry in the `react-server` export condition; ordering is
correct (types before import/default). The corresponding source
`src/index.rsc.ts` exists and the `tsc --emitDeclarationOnly` step will
produce `dist/index.rsc.d.ts` at build time. |
| packages/next/src/__tests__/packageExports.test.ts | New regression
test that reads `package.json` directly and asserts both the
RSC-specific `types` path and the general `types` fallback. The
`packageRoot` path traversal (3× `dirname`) correctly resolves to
`packages/next`. |
| .changeset/gt-next-react-server-types.md | Correct patch-level
changeset for `gt-next` describing the RSC types fix. |
</details>
<details><summary><h3>Flowchart</h3></summary>
<a href="#gh-light-mode-only">
```mermaid
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["TypeScript imports 'gt-next'"] --> B{Which condition?}
B -->|react-server condition active| C["types: ./dist/index.rsc.d.ts NEW"]
B -->|browser condition active| D["(no types field — pre-existing)"]
B -->|default| E["types: ./dist/index.types.d.ts"]
C --> F["RSC-safe declarations\n(no client-only hooks)"]
E --> G["General declarations\n(includes client hooks)"]
```
</a>
<a href="#gh-dark-mode-only">
```mermaid
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A["TypeScript imports 'gt-next'"] --> B{Which condition?}
B -->|react-server condition active| C["types: ./dist/index.rsc.d.ts NEW"]
B -->|browser condition active| D["(no types field — pre-existing)"]
B -->|default| E["types: ./dist/index.types.d.ts"]
C --> F["RSC-safe declarations\n(no client-only hooks)"]
E --> G["General declarations\n(includes client hooks)"]
```
</a>
</details>
<sub>Reviews (1): Last reviewed commit: ["fix: use rsc types for gt-next
react-ser..."](15f4c24)
| [Re-trigger
Greptile](https://app.greptile.com/api/retrigger?id=40945802)</sub>
<!-- /greptile_comment -->
## Summary
- move `gtServicesEnabled` onto the shared `createGlobalSingleton`
registry
- preserve the existing
`globalThis.__generaltranslation.i18n.gtServicesEnabled` namespace/key
- keep uninitialized reads defaulting to `false`
- add a gt-i18n patch changeset
## Notes
- Repeated setup with the same resolved boolean remains quiet.
- The shared singleton warning now fires if setup flips the flag between
enabled and disabled in the same JS realm, which should indicate a
meaningful config change rather than normal runtime behavior.
## Tests
- pnpm --filter gt-i18n test --
src/globals/__tests__/getGTServicesEnabled.test.ts
src/i18n-config/__tests__/singleton-operations.test.ts
- pnpm --filter gt-i18n typecheck
- pnpm exec oxlint packages/i18n/src/globals/getGTServicesEnabled.ts
packages/i18n/src/globals/__tests__/getGTServicesEnabled.test.ts
- pnpm exec oxfmt --check .changeset/gt-services-enabled-singleton.md
packages/i18n/src/globals/getGTServicesEnabled.ts
packages/i18n/src/globals/__tests__/getGTServicesEnabled.test.ts
- git diff --check
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR removes the standalone `setupGTServicesEnabled` global and folds
the `gtServicesEnabled` flag directly into the `I18nConfig` class, which
is already managed via the shared `createGlobalSingleton` registry. All
downstream callers (Next, Node, React, React Native) drop their separate
`setupGTServicesEnabled` call and now rely solely on
`initializeI18nConfig`.
- `cacheUrl` is promoted into `I18nConfigParams` so the
`resolveGTServicesEnabled` logic (which needs it) can live entirely
inside `I18nConfig`'s constructor without a separate parameter bag.
- `validateI18nConfigParams` is updated to accept the already-resolved
`gtServicesEnabled` boolean as an explicit argument instead of reading
the old global, eliminating the circular dependency between the
validator and the global setter.
- All tests pass and a new case pins the "returns false before config is
initialized" contract.
<details open><summary><h3>Confidence Score: 5/5</h3></summary>
Safe to merge; the refactoring correctly consolidates a previously
split-brain flag into a single, already-tested singleton.
The change removes a parallel global write and re-homes the flag
computation inside I18nConfig's constructor, which is the natural owner.
All call sites are updated, the validation function is now testable in
isolation, and the uninitialized-default contract is now verified by a
test. No behavioral regressions identified.
packages/next/src/setup/shared.ts — the NextSetupI18nConfigParams alias
can be simplified now that cacheUrl is part of I18nConfigParams, but
this has no runtime impact.
</details>
<details><summary><h3>Important Files Changed</h3></summary>
| Filename | Overview |
|----------|----------|
| packages/i18n/src/globals/getGTServicesEnabled.ts | Simplified to a
thin wrapper over the I18nConfig singleton; correctly returns false
before initialization. setupGTServicesEnabled removed. |
| packages/i18n/src/i18n-config/I18nConfig.ts | Adds cacheUrl to
I18nConfigParams, moves resolveGTServicesEnabled logic here, stores
result as a private field. Clean consolidation. |
| packages/i18n/src/i18n-config/validation.ts | Eliminates the global
read in favor of an explicit parameter; no logic change, avoids the need
to read the global singleton during construction. |
| packages/next/src/setup/shared.ts | Removes the separate
gtservicesEnabledParams block; adds cacheUrl directly to
i18nConfigParams. Introduces NextSetupI18nConfigParams which is now
redundant given cacheUrl is already in I18nConfigParams. |
| packages/i18n/src/globals/__tests__/getGTServicesEnabled.test.ts |
Updated to use initializeI18nConfig; adds the previously-missing test
for the uninitialized default (false). Addresses prior review comment. |
| packages/i18n/src/i18n-config/__tests__/singleton-operations.test.ts |
Removes the gtServicesEnabled field from the singleton shape type and
adds a dedicated test verifying the flag is stored and retrievable via
the config singleton. |
| packages/next/src/setup/initGT.ts | Drops the separate
setupGTServicesEnabled call; initializeI18nConfig now owns the full
setup. Correctly uses NextSetupI18nConfigParams. |
| packages/node/src/setup/initializeGT.ts | Removes
setupGTServicesEnabled call; initializeI18nConfig takes full
responsibility. Clean one-line removal. |
</details>
<details><summary><h3>Flowchart</h3></summary>
<a href="#gh-light-mode-only">
```mermaid
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["initializeGT() / initializeI18nConfig()"] --> B["new I18nConfig(params)"]
B --> C["resolveGTServicesEnabled(params)\n(getLoadTranslationsType | getTranslationApiType)"]
C --> D["gtServicesEnabled: boolean"]
D --> E["validateI18nConfigParams(params, gtServicesEnabled)"]
D --> F["this.gtServicesEnabled = gtServicesEnabled"]
B --> G["setI18nConfig(instance)\ncreateGlobalSingleton registry"]
G --> H["globalThis.__generaltranslation.i18n.i18nConfig"]
H --> I["getGTServicesEnabled()\n-> isI18nConfigInitialized()\n ? getI18nConfig().isGTServicesEnabled()\n : false"]
```
</a>
<a href="#gh-dark-mode-only">
```mermaid
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A["initializeGT() / initializeI18nConfig()"] --> B["new I18nConfig(params)"]
B --> C["resolveGTServicesEnabled(params)\n(getLoadTranslationsType | getTranslationApiType)"]
C --> D["gtServicesEnabled: boolean"]
D --> E["validateI18nConfigParams(params, gtServicesEnabled)"]
D --> F["this.gtServicesEnabled = gtServicesEnabled"]
B --> G["setI18nConfig(instance)\ncreateGlobalSingleton registry"]
G --> H["globalThis.__generaltranslation.i18n.i18nConfig"]
H --> I["getGTServicesEnabled()\n-> isI18nConfigInitialized()\n ? getI18nConfig().isGTServicesEnabled()\n : false"]
```
</a>
</details>
<sub>Reviews (2): Last reviewed commit: ["refactor: store gt services
flag on
i18n..."](eeb2452)
| [Re-trigger
Greptile](https://app.greptile.com/api/retrigger?id=40948338)</sub>
<!-- /greptile_comment -->
## Summary
- replace the hand-rolled react-core context global registry with
createGlobalSingleton
- preserve the existing reactCore/gtContext global slot and lazy
creation behavior
## Testing
- pnpm exec oxlint packages/react-core/src/context/context.ts
- pnpm exec oxfmt --check packages/react-core/src/context/context.ts
- git diff --check
- pnpm --filter @generaltranslation/react-core test
- pnpm --filter @generaltranslation/react-core typecheck
- pnpm --filter gt-react test
- pnpm --filter gt-react typecheck
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR refactors `packages/react-core/src/context/context.ts` to
replace three hand-rolled TypeScript interfaces and the
`getReactCoreGlobals()` helper with the shared `createGlobalSingleton`
utility from `gt-i18n/internal`, reducing boilerplate while preserving
the same `globalThis.__generaltranslation.reactCore.gtContext` slot.
- The module-level `gtContextSingleton` constant mirrors the old
`getReactCoreGlobals()` plumbing exactly — same `namespace`
(`reactCore`) and `key` (`gtContext`) — so the global slot is unchanged
across package instances.
- `getGTContext()` preserves the lazy-creation pattern: it calls
`isInitialized()` before `set()`, so `createContext` is still invoked at
most once, and the new `set()` overwrite-warning path is never reached
through normal usage.
<details open><summary><h3>Confidence Score: 5/5</h3></summary>
Safe to merge — the refactor is a direct mechanical substitution of
equivalent logic with no functional change.
The global slot (__generaltranslation.reactCore.gtContext) is identical
to what the old hand-rolled helper produced. The lazy-init guard
(isInitialized() → set() → get()) matches the old ??= semantics
precisely, and set() is only called when the slot is empty so the new
overwrite-warning path is unreachable in normal use. The removed
TypeScript types were internal implementation detail only. Nothing in
the public API or runtime behavior changes.
No files require special attention.
</details>
<details><summary><h3>Important Files Changed</h3></summary>
| Filename | Overview |
|----------|----------|
| packages/react-core/src/context/context.ts | Replaces hand-rolled
global-registry types and helper with createGlobalSingleton;
namespace/key alignment is preserved, lazy-init behavior is equivalent.
|
</details>
<details><summary><h3>Sequence Diagram</h3></summary>
<a href="#gh-light-mode-only">
```mermaid
%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Caller
participant getGTContext
participant gtContextSingleton
participant globalThis
Caller->>getGTContext: getGTContext()
getGTContext->>gtContextSingleton: isInitialized()
gtContextSingleton->>globalThis: globalThis.__generaltranslation["reactCore"]["gtContext"]
globalThis-->>gtContextSingleton: undefined (first call)
gtContextSingleton-->>getGTContext: false
getGTContext->>getGTContext: createContext(undefined)
getGTContext->>gtContextSingleton: set(ctx)
gtContextSingleton->>globalThis: store ctx at ["reactCore"]["gtContext"]
getGTContext->>gtContextSingleton: get()
gtContextSingleton->>globalThis: read ["reactCore"]["gtContext"]
globalThis-->>gtContextSingleton: ctx
gtContextSingleton-->>getGTContext: ctx
getGTContext-->>Caller: ctx
Note over Caller,globalThis: Subsequent calls — slot already populated
Caller->>getGTContext: getGTContext()
getGTContext->>gtContextSingleton: isInitialized()
gtContextSingleton->>globalThis: read ["reactCore"]["gtContext"]
globalThis-->>gtContextSingleton: ctx
gtContextSingleton-->>getGTContext: true
getGTContext->>gtContextSingleton: get()
gtContextSingleton-->>getGTContext: ctx
getGTContext-->>Caller: ctx
```
</a>
<a href="#gh-dark-mode-only">
```mermaid
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Caller
participant getGTContext
participant gtContextSingleton
participant globalThis
Caller->>getGTContext: getGTContext()
getGTContext->>gtContextSingleton: isInitialized()
gtContextSingleton->>globalThis: globalThis.__generaltranslation["reactCore"]["gtContext"]
globalThis-->>gtContextSingleton: undefined (first call)
gtContextSingleton-->>getGTContext: false
getGTContext->>getGTContext: createContext(undefined)
getGTContext->>gtContextSingleton: set(ctx)
gtContextSingleton->>globalThis: store ctx at ["reactCore"]["gtContext"]
getGTContext->>gtContextSingleton: get()
gtContextSingleton->>globalThis: read ["reactCore"]["gtContext"]
globalThis-->>gtContextSingleton: ctx
gtContextSingleton-->>getGTContext: ctx
getGTContext-->>Caller: ctx
Note over Caller,globalThis: Subsequent calls — slot already populated
Caller->>getGTContext: getGTContext()
getGTContext->>gtContextSingleton: isInitialized()
gtContextSingleton->>globalThis: read ["reactCore"]["gtContext"]
globalThis-->>gtContextSingleton: ctx
gtContextSingleton-->>getGTContext: true
getGTContext->>gtContextSingleton: get()
gtContextSingleton-->>getGTContext: ctx
getGTContext-->>Caller: ctx
```
</a>
</details>
<sub>Reviews (1): Last reviewed commit: ["refactor: use shared singleton
for
react..."](46bec0e)
| [Re-trigger
Greptile](https://app.greptile.com/api/retrigger?id=40949786)</sub>
<!-- /greptile_comment -->
## Summary
- re-export the missing platform-neutral
@generaltranslation/react-core/pure helpers from gt-react-native
- expose ReactI18nCache and ReactI18nCacheParams from gt-react-native to
match gt-react parity
## Testing
- pnpm --filter gt-react-native test
- pnpm --filter gt-react-native build
- pnpm exec oxfmt --check packages/react-native/src/index.tsx
- git diff --check
- confirmed the new names appear in
packages/react-native/dist/module/index.d.ts
- AST parity check: no @generaltranslation/react-core/pure exports
remain present in gt-react but missing from gt-react-native
## Notes
- pnpm --filter gt-react-native typecheck currently fails in untouched
src/hooks/selectors.ts with TS2742 about an inferred non-portable return
type.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR adds four previously missing re-exports (`getDefaultLocale`,
`getGTClass`, `getLocales`, `getVersionId`) from
`@generaltranslation/react-core/pure` to the `gt-react-native` public
surface, closing part of the gap with `gt-react`.
- Four helpers that were already available in
`@generaltranslation/react-core/pure` are now forwarded through
`gt-react-native/src/index.tsx`, matching the corresponding block in
`gt-react/src/index.client.ts`.
- `ReactI18nCache` and `ReactI18nCacheParams` are explicitly listed in
the PR description as being added, but no re-export for them appears in
the actual diff; they remain absent from `gt-react-native`.
- `getLocaleProperties` is present in both `pure.ts` and `gt-react`'s
public API but is still not forwarded by `gt-react-native`, making the
"AST parity check: zero gaps remain" claim in the PR description
inaccurate.
<details open><summary><h3>Confidence Score: 4/5</h3></summary>
Safe to merge for the four symbols that were added, but the PR does not
fully deliver on two explicit claims in its description.
The four new re-exports are correct and low-risk. However,
ReactI18nCache and ReactI18nCacheParams are specifically called out in
the PR description as being added, yet they appear nowhere in the diff.
getLocaleProperties is also absent despite the stated AST parity
guarantee. Users or internal tooling that depends on these symbols will
still find them missing from gt-react-native after this PR merges.
packages/react-native/src/index.tsx — needs the ReactI18nCache,
ReactI18nCacheParams, and getLocaleProperties re-exports that are
described but not present.
</details>
<details><summary><h3>Important Files Changed</h3></summary>
| Filename | Overview |
|----------|----------|
| packages/react-native/src/index.tsx | Adds four missing re-exports
(getDefaultLocale, getGTClass, getLocales, getVersionId) from
@generaltranslation/react-core/pure, but two items explicitly named in
the PR description (ReactI18nCache, ReactI18nCacheParams) and one more
expected by the parity claim (getLocaleProperties) are still absent. |
</details>
<details><summary><h3>Flowchart</h3></summary>
<a href="#gh-light-mode-only">
```mermaid
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["@generaltranslation/react-core/pure"]
A -->|"getDefaultLocale, getGTClass,\ngetLocales, getVersionId\n(ADDED by this PR)"| B["gt-react-native/src/index.tsx"]
A -->|"getDefaultLocale, getGTClass,\ngetLocales, getVersionId,\ngetLocaleProperties,\nReactI18nCache, ReactI18nCacheParams\n(already present)"| C["gt-react/src/index.client.ts"]
A -->|"getLocaleProperties missing\nReactI18nCache missing\nReactI18nCacheParams missing"| B
B --> D["gt-react-native consumers"]
C --> E["gt-react consumers"]
```
</a>
<a href="#gh-dark-mode-only">
```mermaid
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A["@generaltranslation/react-core/pure"]
A -->|"getDefaultLocale, getGTClass,\ngetLocales, getVersionId\n(ADDED by this PR)"| B["gt-react-native/src/index.tsx"]
A -->|"getDefaultLocale, getGTClass,\ngetLocales, getVersionId,\ngetLocaleProperties,\nReactI18nCache, ReactI18nCacheParams\n(already present)"| C["gt-react/src/index.client.ts"]
A -->|"getLocaleProperties missing\nReactI18nCache missing\nReactI18nCacheParams missing"| B
B --> D["gt-react-native consumers"]
C --> E["gt-react consumers"]
```
</a>
</details>
<!-- greptile_failed_comments -->
<details open><summary><h3>Comments Outside Diff (1)</h3></summary>
1. `packages/react-native/src/index.tsx`, line 63-73
([link](https://github.com/generaltranslation/gt/blob/302e395609b6783dfa98e5e526bf815ae502bc4c/packages/react-native/src/index.tsx#L63-L73))
<a href="#"><img alt="P1"
src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9"
align="top"></a> **ReactI18nCache / ReactI18nCacheParams not actually
exported**
The PR description states "expose ReactI18nCache and
ReactI18nCacheParams from gt-react-native to match gt-react parity", but
neither symbol appears anywhere in the post-PR `index.tsx`. Both are
exported from `@generaltranslation/react-core/pure` (see `pure.ts` lines
79–81) and are re-exported from `gt-react` (`index.client.ts` lines
116–118), but no corresponding re-export was added here. This leaves a
concrete API gap between `gt-react` and `gt-react-native` despite the
stated goal.
<details><summary>Prompt To Fix With AI</summary>
`````markdown
This is a comment left during a code review.
Path: packages/react-native/src/index.tsx
Line: 63-73
Comment:
**ReactI18nCache / ReactI18nCacheParams not actually exported**
The PR description states "expose ReactI18nCache and
ReactI18nCacheParams from gt-react-native to match gt-react parity", but
neither symbol appears anywhere in the post-PR `index.tsx`. Both are
exported from `@generaltranslation/react-core/pure` (see `pure.ts` lines
79–81) and are re-exported from `gt-react` (`index.client.ts` lines
116–118), but no corresponding re-export was added here. This leaves a
concrete API gap between `gt-react` and `gt-react-native` despite the
stated goal.
How can I resolve this? If you propose a fix, please make it concise.
`````
</details>
Note: If this suggestion doesn't match your team's coding style, reply
to this and let me know. I'll remember it for next time!
<a
href="https://app.greptile.com/ide/claude-code?prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0APath%3A%20packages%2Freact-native%2Fsrc%2Findex.tsx%0ALine%3A%2063-73%0A%0AComment%3A%0A**ReactI18nCache%20%2F%20ReactI18nCacheParams%20not%20actually%20exported**%0A%0AThe%20PR%20description%20states%20%22expose%20ReactI18nCache%20and%20ReactI18nCacheParams%20from%20gt-react-native%20to%20match%20gt-react%20parity%22%2C%20but%20neither%20symbol%20appears%20anywhere%20in%20the%20post-PR%20%60index.tsx%60.%20Both%20are%20exported%20from%20%60%40generaltranslation%2Freact-core%2Fpure%60%20%28see%20%60pure.ts%60%20lines%2079%E2%80%9381%29%20and%20are%20re-exported%20from%20%60gt-react%60%20%28%60index.client.ts%60%20lines%20116%E2%80%93118%29%2C%20but%20no%20corresponding%20re-export%20was%20added%20here.%20This%20leaves%20a%20concrete%20API%20gap%20between%20%60gt-react%60%20and%20%60gt-react-native%60%20despite%20the%20stated%20goal.%0A%0AHow%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20please%20make%20it%20concise.&repo=generaltranslation%2Fgt&pr=1734&platform=github"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaudeDark.svg?v=4"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaude.svg?v=4"><img
alt="Fix in Claude Code"
src="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaude.svg?v=4"></picture></a>
<a
href="https://app.greptile.com/api/ide/codex?prompt=IMPORTANT%3A%20Work%20in%20the%20repository%20%22generaltranslation%2Fgt%22%20on%20the%20existing%20branch%20%22bg%2Freact-native-pure-parity%22.%20Checkout%20that%20branch%20%E2%80%94%20do%20NOT%20create%20a%20new%20branch%20or%20open%20a%20new%20PR.%20Push%20your%20changes%20to%20%22bg%2Freact-native-pure-parity%22.%0A%0AThis%20is%20a%20comment%20left%20during%20a%20code%20review.%0APath%3A%20packages%2Freact-native%2Fsrc%2Findex.tsx%0ALine%3A%2063-73%0A%0AComment%3A%0A**ReactI18nCache%20%2F%20ReactI18nCacheParams%20not%20actually%20exported**%0A%0AThe%20PR%20description%20states%20%22expose%20ReactI18nCache%20and%20ReactI18nCacheParams%20from%20gt-react-native%20to%20match%20gt-react%20parity%22%2C%20but%20neither%20symbol%20appears%20anywhere%20in%20the%20post-PR%20%60index.tsx%60.%20Both%20are%20exported%20from%20%60%40generaltranslation%2Freact-core%2Fpure%60%20%28see%20%60pure.ts%60%20lines%2079%E2%80%9381%29%20and%20are%20re-exported%20from%20%60gt-react%60%20%28%60index.client.ts%60%20lines%20116%E2%80%93118%29%2C%20but%20no%20corresponding%20re-export%20was%20added%20here.%20This%20leaves%20a%20concrete%20API%20gap%20between%20%60gt-react%60%20and%20%60gt-react-native%60%20despite%20the%20stated%20goal.%0A%0AHow%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20please%20make%20it%20concise.&repo=generaltranslation%2Fgt&pr=1734&platform=github"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCodexDark.svg?v=4"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCodex.svg?v=4"><img
alt="Fix in Codex"
src="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCodex.svg?v=4"></picture></a>
</details>
<!-- /greptile_failed_comments -->
<a
href="https://app.greptile.com/ide/claude-code?prompt=Fix%20the%20following%202%20code%20review%20issues.%20Work%20through%20them%20one%20at%20a%20time%2C%20proposing%20concise%20fixes.%0A%0A---%0A%0A%23%23%23%20Issue%201%20of%202%0Apackages%2Freact-native%2Fsrc%2Findex.tsx%3A63-73%0A**ReactI18nCache%20%2F%20ReactI18nCacheParams%20not%20actually%20exported**%0A%0AThe%20PR%20description%20states%20%22expose%20ReactI18nCache%20and%20ReactI18nCacheParams%20from%20gt-react-native%20to%20match%20gt-react%20parity%22%2C%20but%20neither%20symbol%20appears%20anywhere%20in%20the%20post-PR%20%60index.tsx%60.%20Both%20are%20exported%20from%20%60%40generaltranslation%2Freact-core%2Fpure%60%20%28see%20%60pure.ts%60%20lines%2079%E2%80%9381%29%20and%20are%20re-exported%20from%20%60gt-react%60%20%28%60index.client.ts%60%20lines%20116%E2%80%93118%29%2C%20but%20no%20corresponding%20re-export%20was%20added%20here.%20This%20leaves%20a%20concrete%20API%20gap%20between%20%60gt-react%60%20and%20%60gt-react-native%60%20despite%20the%20stated%20goal.%0A%0A%23%23%23%20Issue%202%20of%202%0Apackages%2Freact-native%2Fsrc%2Findex.tsx%3A47-50%0A**getLocaleProperties%20still%20absent%20despite%20parity%20claim**%0A%0A%60gt-react%60%20%28%60index.client.ts%60%20line%2085%29%20exports%20%60getLocaleProperties%60%20from%20%60%40generaltranslation%2Freact-core%2Fpure%60%2C%20and%20%60pure.ts%60%20%28line%20118%29%20confirms%20the%20export%20exists.%20The%20PR%20description%20claims%20%22AST%20parity%20check%3A%20no%20%60%40generaltranslation%2Freact-core%2Fpure%60%20exports%20remain%20present%20in%20gt-react%20but%20missing%20from%20gt-react-native%22%2C%20but%20%60getLocaleProperties%60%20is%20still%20missing%20here.%20Omitting%20it%20leaves%20callers%20who%20upgrade%20from%20%60gt-react%60%20to%20%60gt-react-native%60%20without%20a%20drop-in%20equivalent.%0A%0A%60%60%60suggestion%0A%20%20getDefaultLocale%2C%0A%20%20getFormatLocales%2C%0A%20%20getGTClass%2C%0A%20%20getLocaleProperties%2C%0A%20%20getLocales%2C%0A%60%60%60%0A%0A&repo=generaltranslation%2Fgt&pr=1734&platform=github"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInClaudeDark.svg?v=4"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInClaude.svg?v=4"><img
alt="Fix All in Claude Code"
src="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInClaude.svg?v=4"></picture></a>
<a
href="https://app.greptile.com/api/ide/codex?prompt=IMPORTANT%3A%20Work%20in%20the%20repository%20%22generaltranslation%2Fgt%22%20on%20the%20existing%20branch%20%22bg%2Freact-native-pure-parity%22.%20Checkout%20that%20branch%20%E2%80%94%20do%20NOT%20create%20a%20new%20branch%20or%20open%20a%20new%20PR.%20Push%20your%20changes%20to%20%22bg%2Freact-native-pure-parity%22.%0A%0AFix%20the%20following%202%20code%20review%20issues.%20Work%20through%20them%20one%20at%20a%20time%2C%20proposing%20concise%20fixes.%0A%0A---%0A%0A%23%23%23%20Issue%201%20of%202%0Apackages%2Freact-native%2Fsrc%2Findex.tsx%3A63-73%0A**ReactI18nCache%20%2F%20ReactI18nCacheParams%20not%20actually%20exported**%0A%0AThe%20PR%20description%20states%20%22expose%20ReactI18nCache%20and%20ReactI18nCacheParams%20from%20gt-react-native%20to%20match%20gt-react%20parity%22%2C%20but%20neither%20symbol%20appears%20anywhere%20in%20the%20post-PR%20%60index.tsx%60.%20Both%20are%20exported%20from%20%60%40generaltranslation%2Freact-core%2Fpure%60%20%28see%20%60pure.ts%60%20lines%2079%E2%80%9381%29%20and%20are%20re-exported%20from%20%60gt-react%60%20%28%60index.client.ts%60%20lines%20116%E2%80%93118%29%2C%20but%20no%20corresponding%20re-export%20was%20added%20here.%20This%20leaves%20a%20concrete%20API%20gap%20between%20%60gt-react%60%20and%20%60gt-react-native%60%20despite%20the%20stated%20goal.%0A%0A%23%23%23%20Issue%202%20of%202%0Apackages%2Freact-native%2Fsrc%2Findex.tsx%3A47-50%0A**getLocaleProperties%20still%20absent%20despite%20parity%20claim**%0A%0A%60gt-react%60%20%28%60index.client.ts%60%20line%2085%29%20exports%20%60getLocaleProperties%60%20from%20%60%40generaltranslation%2Freact-core%2Fpure%60%2C%20and%20%60pure.ts%60%20%28line%20118%29%20confirms%20the%20export%20exists.%20The%20PR%20description%20claims%20%22AST%20parity%20check%3A%20no%20%60%40generaltranslation%2Freact-core%2Fpure%60%20exports%20remain%20present%20in%20gt-react%20but%20missing%20from%20gt-react-native%22%2C%20but%20%60getLocaleProperties%60%20is%20still%20missing%20here.%20Omitting%20it%20leaves%20callers%20who%20upgrade%20from%20%60gt-react%60%20to%20%60gt-react-native%60%20without%20a%20drop-in%20equivalent.%0A%0A%60%60%60suggestion%0A%20%20getDefaultLocale%2C%0A%20%20getFormatLocales%2C%0A%20%20getGTClass%2C%0A%20%20getLocaleProperties%2C%0A%20%20getLocales%2C%0A%60%60%60%0A%0A&repo=generaltranslation%2Fgt&pr=1734&platform=github"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCodexDark.svg?v=4"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCodex.svg?v=4"><img
alt="Fix All in Codex"
src="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCodex.svg?v=4"></picture></a>
<details><summary>Prompt To Fix All With AI</summary>
`````markdown
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
packages/react-native/src/index.tsx:63-73
**ReactI18nCache / ReactI18nCacheParams not actually exported**
The PR description states "expose ReactI18nCache and ReactI18nCacheParams from gt-react-native to match gt-react parity", but neither symbol appears anywhere in the post-PR `index.tsx`. Both are exported from `@generaltranslation/react-core/pure` (see `pure.ts` lines 79–81) and are re-exported from `gt-react` (`index.client.ts` lines 116–118), but no corresponding re-export was added here. This leaves a concrete API gap between `gt-react` and `gt-react-native` despite the stated goal.
### Issue 2 of 2
packages/react-native/src/index.tsx:47-50
**getLocaleProperties still absent despite parity claim**
`gt-react` (`index.client.ts` line 85) exports `getLocaleProperties` from `@generaltranslation/react-core/pure`, and `pure.ts` (line 118) confirms the export exists. The PR description claims "AST parity check: no `@generaltranslation/react-core/pure` exports remain present in gt-react but missing from gt-react-native", but `getLocaleProperties` is still missing here. Omitting it leaves callers who upgrade from `gt-react` to `gt-react-native` without a drop-in equivalent.
```suggestion
getDefaultLocale,
getFormatLocales,
getGTClass,
getLocaleProperties,
getLocales,
```
`````
</details>
<sub>Reviews (2): Last reviewed commit: ["fix: mirror pure exports in
react
native"](302e395)
| [Re-trigger
Greptile](https://app.greptile.com/api/retrigger?id=40951736)</sub>
> Greptile also left **1 inline comment** on this PR.
<!-- /greptile_comment -->
## Summary
- remove unused CLI console/format exports and an unused auth header
utility
- remove redundant gt-i18n internal type re-export
- remove unused react-core pure/condition-store exports and auth env
types
## Tests
- pnpm --filter gt typecheck
- pnpm --filter gt-i18n typecheck
- pnpm --filter @generaltranslation/react-core typecheck
- git diff --check
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR removes dead internal exports across three packages (`gt`,
`gt-i18n`, `@generaltranslation/react-core`) — string constants, a
utility function, type definitions, and re-export aliases that have no
remaining consumers in the codebase.
- **CLI (`gt`)**: Removes unused `noSupportedFormatError` string, the
`SUPPORTED_DATA_FORMATS` array, and deletes the entire `headers.ts`
utility file containing `getAuthHeaders`.
- **i18n**: Removes a redundant named re-export of `TranslationMetadata`
that was already covered by the preceding `export type *` wildcard.
- **react-core**: Removes the `getConditionStore as
getReadonlyConditionStore` alias (all consumers use the `WithFallback`
variant) and the `AuthFromEnvParams`/`AuthFromEnvReturn` type
definitions and their public re-exports.
<details open><summary><h3>Confidence Score: 5/5</h3></summary>
All removals are confirmed dead code with no remaining consumers — safe
to merge.
Every removed export was verified against the full codebase: no
remaining imports of `noSupportedFormatError`, `SUPPORTED_DATA_FORMATS`,
`getAuthHeaders`, `getReadonlyConditionStore` (bare alias),
`AuthFromEnvParams`, or `AuthFromEnvReturn`. The `TranslationMetadata`
named re-export was redundant due to the existing `export type *`
wildcard. The accompanying typecheck CI steps cover each affected
package.
No files require special attention — all changes are straightforward
dead-code removals.
</details>
<details><summary><h3>Important Files Changed</h3></summary>
| Filename | Overview |
|----------|----------|
| packages/cli/src/console/index.ts | Removes `noSupportedFormatError`
constant — confirmed unused across the codebase. |
| packages/cli/src/formats/files/aggregateFiles.ts | Removes
`SUPPORTED_DATA_FORMATS` exported constant — confirmed unused across the
codebase. |
| packages/cli/src/utils/headers.ts | Deletes entire file containing
`getAuthHeaders` utility — confirmed no imports of this file or function
remain anywhere. |
| packages/i18n/src/internal-types.ts | Removes redundant explicit
re-export of `TranslationMetadata`, which is already covered by the
preceding `export type *` wildcard from the same source file. |
| packages/react-core/src/condition-store/singleton-operations.ts |
Removes `getConditionStore as getReadonlyConditionStore` alias from the
export block; all consumers in the codebase use the `WithFallback`
variant, so this alias had zero consumers. |
| packages/react-core/src/pure.ts | Removes `AuthFromEnvParams` and
`AuthFromEnvReturn` type re-exports — both types are being deleted at
source and have no remaining consumers. |
| packages/react-core/src/utils/types.ts | Deletes `AuthFromEnvParams`
and `AuthFromEnvReturn` type definitions — confirmed unused across the
entire codebase. |
</details>
<details><summary><h3>Flowchart</h3></summary>
<a href="#gh-light-mode-only">
```mermaid
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Dead Export Removal PR] --> B[packages/cli]
A --> C[packages/i18n]
A --> D[packages/react-core]
B --> B1["console/index.ts\n- noSupportedFormatError ❌"]
B --> B2["formats/files/aggregateFiles.ts\n- SUPPORTED_DATA_FORMATS ❌"]
B --> B3["utils/headers.ts\n- getAuthHeaders() ❌ (file deleted)"]
C --> C1["internal-types.ts\n- TranslationMetadata (redundant re-export) ❌\n already covered by export type *"]
D --> D1["condition-store/singleton-operations.ts\n- getConditionStore as getReadonlyConditionStore ❌\n all callers use WithFallback variant"]
D --> D2["pure.ts\n- AuthFromEnvParams ❌\n- AuthFromEnvReturn ❌"]
D --> D3["utils/types.ts\n- AuthFromEnvParams type def ❌\n- AuthFromEnvReturn type def ❌"]
```
</a>
<a href="#gh-dark-mode-only">
```mermaid
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[Dead Export Removal PR] --> B[packages/cli]
A --> C[packages/i18n]
A --> D[packages/react-core]
B --> B1["console/index.ts\n- noSupportedFormatError ❌"]
B --> B2["formats/files/aggregateFiles.ts\n- SUPPORTED_DATA_FORMATS ❌"]
B --> B3["utils/headers.ts\n- getAuthHeaders() ❌ (file deleted)"]
C --> C1["internal-types.ts\n- TranslationMetadata (redundant re-export) ❌\n already covered by export type *"]
D --> D1["condition-store/singleton-operations.ts\n- getConditionStore as getReadonlyConditionStore ❌\n all callers use WithFallback variant"]
D --> D2["pure.ts\n- AuthFromEnvParams ❌\n- AuthFromEnvReturn ❌"]
D --> D3["utils/types.ts\n- AuthFromEnvParams type def ❌\n- AuthFromEnvReturn type def ❌"]
```
</a>
</details>
<sub>Reviews (1): Last reviewed commit: ["refactor: remove dead internal
exports"](d5576f6)
| [Re-trigger
Greptile](https://app.greptile.com/api/retrigger?id=40963643)</sub>
<!-- /greptile_comment -->
## Summary
- add explicit portable selector hook result types in react-core
- reuse those types in gt-react-native selector hooks to avoid
non-nameable declaration output
- add a patch changeset for react-core and gt-react-native
## Checks
- pnpm --filter @generaltranslation/react-core typecheck
- pnpm --filter gt-react typecheck
- pnpm --filter gt-react-native typecheck
- pnpm format
- git diff --check
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR adds explicit TypeScript return types to the
`useInternalLocaleSelector` and `useInternalRegionSelector` hooks in
`react-core`, then reuses those exported types in the `gt-react-native`
selector wrappers to fix TS2742 errors that occur in project-reference
builds when TypeScript tries to name inferred types that reach into
non-portable bundled declarations from `generaltranslation`.
- **`react-core`**: Introduces `InternalLocaleSelectorResult` and
`InternalRegionSelectorResult` types, annotates the hook functions with
those types, and re-exports them from the hooks barrel (`hooks.ts`).
- **`gt-react-native`**: Updates `useLocaleSelector` and
`useRegionSelector` to declare explicit return types as intersections of
the newly exported core result types with their respective setter
signatures.
- **Changeset**: A patch bump for both `@generaltranslation/react-core`
and `gt-react-native` is included.
<details open><summary><h3>Confidence Score: 5/5</h3></summary>
Pure TypeScript type-annotation additions with no runtime behavior
changes; safe to merge.
All changes are additive type exports and explicit return-type
annotations. The declared types accurately reflect the objects each hook
already returned. No logic, runtime paths, or public APIs are altered.
No files require special attention.
</details>
<details><summary><h3>Important Files Changed</h3></summary>
| Filename | Overview |
|----------|----------|
| packages/react-core/src/hooks/useInternalLocaleSelector.ts | Adds
explicit InternalLocaleSelectorResult type and annotates the function's
return type; types accurately match the actual returned shape. |
| packages/react-core/src/hooks/useInternalRegionSelector.ts | Adds
InternalRegionSelectorResult type and annotates the function's return;
all five fields match the returned object exactly. |
| packages/react-core/src/hooks.ts | Re-exports the two new result types
from the hooks barrel; no functional changes. |
| packages/react-native/src/hooks/selectors.ts | Annotates
useLocaleSelector and useRegionSelector with explicit intersection
return types reusing the newly exported core types; resolves TS2742 for
project-reference builds. |
| .changeset/react-native-selector-return-types.md | Correct patch
changeset targeting both @generaltranslation/react-core and
gt-react-native. |
</details>
<details><summary><h3>Class Diagram</h3></summary>
<a href="#gh-light-mode-only">
```mermaid
%%{init: {'theme': 'neutral'}}%%
classDiagram
class InternalLocaleSelectorResult {
+string locale
+string[] locales
+getLocaleProperties(locale: string) LocaleProperties
}
class InternalRegionSelectorResult {
+string|undefined region
+string[] regions
+Map~string,RegionData~ regionData
+string locale
+string localeRegion
}
class useLocaleSelector {
+InternalLocaleSelectorResult & setLocale
}
class useRegionSelector {
+InternalRegionSelectorResult & setLocale & setRegion
}
useLocaleSelector --|> InternalLocaleSelectorResult : extends
useRegionSelector --|> InternalRegionSelectorResult : extends
```
</a>
<a href="#gh-dark-mode-only">
```mermaid
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
classDiagram
class InternalLocaleSelectorResult {
+string locale
+string[] locales
+getLocaleProperties(locale: string) LocaleProperties
}
class InternalRegionSelectorResult {
+string|undefined region
+string[] regions
+Map~string,RegionData~ regionData
+string locale
+string localeRegion
}
class useLocaleSelector {
+InternalLocaleSelectorResult & setLocale
}
class useRegionSelector {
+InternalRegionSelectorResult & setLocale & setRegion
}
useLocaleSelector --|> InternalLocaleSelectorResult : extends
useRegionSelector --|> InternalRegionSelectorResult : extends
```
</a>
</details>
<sub>Reviews (1): Last reviewed commit: ["fix: add portable selector
return
types"](b5303b1)
| [Re-trigger
Greptile](https://app.greptile.com/api/retrigger?id=40965389)</sub>
<!-- /greptile_comment -->
## Summary
- pass prebuilt child renderers into createRenderPreparedT
- keep renderPreparedT shared logic free of child renderer construction
- add a patch changeset for react-core
## Checks
- pnpm --filter @generaltranslation/react-core typecheck
- pnpm --filter @generaltranslation/react-core test
- pnpm format
- git diff --check
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR refactors the render pipeline so that `createRenderPreparedT`
receives already-constructed `renderDefaultChildren` and
`renderTranslatedChildren` instances rather than re-creating them
internally from `renderVariable`. The result is one fewer
`createRenderTranslatedChildren` call per pipeline instantiation and a
cleaner separation of concerns inside `renderPreparedT.shared.ts`.
- `createRenderPipeline.ts` now passes the already-built child renderers
to `createRenderPreparedT`, eliminating the internal construction that
previously happened inside the factory.
- `renderPreparedT.shared.ts` drops its factory imports and accepts the
pre-built renderer functions directly, keeping the module free of any
renderer-construction logic.
<details open><summary><h3>Confidence Score: 4/5</h3></summary>
Safe to merge — purely structural refactor with no behavioral changes to
the rendering logic.
The refactor correctly wires the shared child renderers through
createRenderPipeline and the updated createRenderPreparedT signature.
createRenderTranslatedChildren still constructs its own private
renderDefaultChildren internally (unchanged file), so deduplication is
only partial — the PR achieves its stated goal for renderPreparedT but
leaves one duplicate in renderTranslatedChildren.
renderTranslatedChildren.shared.tsx still builds a private
renderDefaultChildren internally; a follow-up could pass the pre-built
instance in if full sharing is desired.
</details>
<details><summary><h3>Important Files Changed</h3></summary>
| Filename | Overview |
|----------|----------|
| packages/react-core/src/utils/rendering/createRenderPipeline.ts |
Updated to pass pre-built renderDefaultChildren and
renderTranslatedChildren to createRenderPreparedT instead of
renderVariable; logic is straightforward and all four pipeline members
are correctly wired. |
| packages/react-core/src/utils/rendering/renderPreparedT.shared.ts |
Factory signature changed from { renderVariable } to {
renderDefaultChildren, renderTranslatedChildren }; now type-imports the
arg types rather than the constructors, and removes internal
child-renderer construction — no logic changes. |
| .changeset/react-core-render-pipeline-dedup.md | Adds a patch
changeset for @generaltranslation/react-core describing the
deduplication of child renderer construction. |
</details>
<details><summary><h3>Flowchart</h3></summary>
<a href="#gh-light-mode-only">
```mermaid
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[createRenderPipeline] --> B[createRenderVariable\nrenderVariable]
B --> C[createRenderDefaultChildren\nrenderDefaultChildren ①]
B --> D[createRenderTranslatedChildren\nrenderTranslatedChildren]
D --> E[createRenderDefaultChildren\nrenderDefaultChildren ② internal]
C --> F[createRenderPreparedT\nrenderPreparedT]
D --> F
F --> G[RenderPipeline\n renderVariable\n renderDefaultChildren ①\n renderTranslatedChildren\n renderPreparedT]
style E fill:#ffe0b2,stroke:#f57c00
style C fill:#c8e6c9,stroke:#388e3c
style F fill:#c8e6c9,stroke:#388e3c
```
</a>
<a href="#gh-dark-mode-only">
```mermaid
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[createRenderPipeline] --> B[createRenderVariable\nrenderVariable]
B --> C[createRenderDefaultChildren\nrenderDefaultChildren ①]
B --> D[createRenderTranslatedChildren\nrenderTranslatedChildren]
D --> E[createRenderDefaultChildren\nrenderDefaultChildren ② internal]
C --> F[createRenderPreparedT\nrenderPreparedT]
D --> F
F --> G[RenderPipeline\n renderVariable\n renderDefaultChildren ①\n renderTranslatedChildren\n renderPreparedT]
style E fill:#ffe0b2,stroke:#f57c00
style C fill:#c8e6c9,stroke:#388e3c
style F fill:#c8e6c9,stroke:#388e3c
```
</a>
</details>
<sub>Reviews (1): Last reviewed commit: ["refactor: share render
pipeline child
re..."](142f626)
| [Re-trigger
Greptile](https://app.greptile.com/api/retrigger?id=40971275)</sub>
<!-- /greptile_comment -->
## Summary
- remove stale package metadata for non-emitted subpaths
- preserve gt-next link client-boundary files in sideEffects
- align gt-tanstack-start legacy main/module fields with the server
export fallback
- add a patch changeset for gt-next, gt-react, and gt-tanstack-start
## Checks
- pnpm --filter gt-tanstack-start typecheck
- pnpm --filter gt-tanstack-start build
- pnpm --filter gt-next test -- packageExports
- pnpm --filter gt-react test -- react-package
- pnpm format
- git diff --check
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR cleans up stale package metadata across three packages and fixes
a `main`/`module` field misalignment in `gt-tanstack-start`.
- **`gt-next`**: Adds `./dist/link.*` and `./dist/link/Link.*` to
`sideEffects` to prevent bundlers from tree-shaking client-boundary
files; removes `./compiler` and `./eslint-plugin` subpath exports that
had no emitted build output.
- **`gt-react`**: Removes the stale `./setup` entry from `typesVersions`
and `compilerOptions.paths` — no corresponding `.d.cts` was emitted.
- **`gt-tanstack-start`**: Aligns legacy `main`/`module` fields to point
at `index.server.*` (matching the `exports` default fallback), removes
the empty `src/types.ts` file and its `./types` subpath export, and
drops it from the tsdown build entries.
<details open><summary><h3>Confidence Score: 5/5</h3></summary>
Safe to merge — all changes are metadata cleanup and a legacy
entry-point alignment with no runtime logic touched.
Every changed file is either a package.json, a build config, or an empty
source file. The removed subpath exports (./compiler, ./eslint-plugin,
./setup, ./types) have no consumers anywhere in the repo. The
gt-tanstack-start main/module alignment correctly matches what the
exports default fallback already served, fixing a pre-existing mismatch
rather than introducing a behavior change. The sideEffects additions
protect client-boundary link files from being dropped by tree-shakers.
No files require special attention.
</details>
<details><summary><h3>Important Files Changed</h3></summary>
| Filename | Overview |
|----------|----------|
| .changeset/clean-package-config-metadata.md | Patch changeset covering
gt-next, gt-react, and gt-tanstack-start — correctly scoped as a patch
for metadata-only and bug-fix alignment changes. |
| packages/next/package.json | Adds ./dist/link.* and ./dist/link/Link.*
to sideEffects to prevent tree-shaking of client-boundary files; removes
stale ./compiler and ./eslint-plugin subpath exports that had no
corresponding build output. |
| packages/react/package.json | Removes the stale ./setup typesVersions
and compilerOptions.paths entries that had no corresponding emitted
output. |
| packages/tanstack-start/package.json | Aligns legacy main/module
fields with the server export fallback; removes the stale ./types
subpath export and its typesVersions/compilerOptions entries. |
| packages/tanstack-start/src/types.ts | Deleted empty file (zero-byte)
whose corresponding build entry and package.json subpath export are
removed in the same PR. |
| packages/tanstack-start/tsdown.config.mts | Removes src/types.ts from
the build entry list, consistent with the file deletion and package.json
cleanup. |
</details>
<details><summary><h3>Flowchart</h3></summary>
<a href="#gh-light-mode-only">
```mermaid
%%{init: {'theme': 'neutral'}}%%
flowchart TD
subgraph gt-next
N1["sideEffects\n+ ./dist/link.*\n+ ./dist/link/Link.*"] --> N2["Client-boundary files\npreserved from tree-shaking"]
N3["Remove ./compiler export"] --> N4["No emitted build output"]
N5["Remove ./eslint-plugin export"] --> N4
end
subgraph gt-react
R1["Remove ./setup from\ntypesVersions & paths"] --> R2["No emitted .d.cts"]
end
subgraph gt-tanstack-start
T1["main/module: index.client.*\n→ index.server.*"] --> T2["Aligned with exports\ndefault fallback"]
T3["Remove ./types subpath"] --> T4["src/types.ts deleted\n(was empty)"]
T5["tsdown: remove\nsrc/types.ts entry"] --> T4
end
```
</a>
<a href="#gh-dark-mode-only">
```mermaid
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
subgraph gt-next
N1["sideEffects\n+ ./dist/link.*\n+ ./dist/link/Link.*"] --> N2["Client-boundary files\npreserved from tree-shaking"]
N3["Remove ./compiler export"] --> N4["No emitted build output"]
N5["Remove ./eslint-plugin export"] --> N4
end
subgraph gt-react
R1["Remove ./setup from\ntypesVersions & paths"] --> R2["No emitted .d.cts"]
end
subgraph gt-tanstack-start
T1["main/module: index.client.*\n→ index.server.*"] --> T2["Aligned with exports\ndefault fallback"]
T3["Remove ./types subpath"] --> T4["src/types.ts deleted\n(was empty)"]
T5["tsdown: remove\nsrc/types.ts entry"] --> T4
end
```
</a>
</details>
<sub>Reviews (1): Last reviewed commit: ["fix: clean up package
metadata"](17799f3)
| [Re-trigger
Greptile](https://app.greptile.com/api/retrigger?id=40967115)</sub>
<!-- /greptile_comment -->
## Summary - Set translation cache expiry to 0 when Next.js Cache Components are enabled - Treat gt-i18n cache entries with expiresAt 0 as immediately expired without calling Date.now() - Use a file-level "use cache" remote translation loader for default Cache Components translation loading, while preserving custom loadTranslations() - Add gt-i18n and gt-next patch changesets and focused tests ## Testing - pnpm exec oxfmt --check packages/next/src/config.ts packages/next/src/config-dir/props/withGTConfigProps.ts packages/next/src/errors/cacheComponents.ts packages/next/src/setup/shared.ts packages/next/src/setup/__tests__/shared.test.ts packages/next/src/utils/createCacheComponentsLoadTranslations.ts packages/next/src/utils/loadCacheComponentsTranslations.ts packages/next/src/utils/__tests__/createCacheComponentsLoadTranslations.test.ts packages/i18n/src/i18n-cache/translations-manager/ResourceCache.ts packages/i18n/src/i18n-cache/translations-manager/__tests__/ResourceCache.test.ts .changeset/cache-components-disable-expiry.md - pnpm --filter gt-next test:js -- src/__tests__/config.test.ts src/setup/__tests__/shared.test.ts src/utils/__tests__/createCacheComponentsLoadTranslations.test.ts - pnpm --filter gt-i18n test -- src/i18n-cache/translations-manager/__tests__/ResourceCache.test.ts src/i18n-cache/__tests__/I18nCache.test.ts - pnpm --filter gt-next typecheck - pnpm --filter gt-i18n typecheck - pnpm --filter gt-i18n build - pnpm --filter gt-next build:no-swc-plugin - pnpm build:next-app-router-locale-routing-use-cache
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to odysseus, this PR will be updated.⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ `odysseus` is currently in **pre mode** so this branch has prereleases rather than normal releases. If you want to exit prereleases, run `changeset pre exit` on `odysseus`.⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ # Releases ## gt@2.14.51-odysseus.5 ### Patch Changes - 4a5f8e8: Remove unused internal exports and dead utility code. ## @generaltranslation/compiler@1.3.25-odysseus.5 ### Patch Changes - 432fa49: Support dev hot reload lookups for server `getGT` strings. `getGT` can now receive compiler-injected message metadata and prefetch missing translations through the runtime cache in development. `gt-next` forwards the server request conditions into this path so App Router server strings can participate in hot reload translation updates. Compiler-injected `getGT` and `useGT` preload messages now emit the same sugar metadata keys used by runtime lookup options. ## gtx-cli@2.14.51-odysseus.5 ### Patch Changes - Updated dependencies [4a5f8e8] - gt@2.14.51-odysseus.5 ## gt-i18n@1.0.0-odysseus.5 ### Patch Changes - 432fa49: Use Next.js caching semantics for Cache Components by disabling GT cache expiry and development hot reload runtime translation. Async translation and dictionary lookup boundaries now keep synchronous access to the loaded snapshot, so APIs like `getGT` and `getTranslations` can still resolve strings after cache expiry is delegated to Next.js. Global singleton setup now preserves the first initialized instance instead of replacing it on later initialization attempts. - 432fa49: Support dev hot reload lookups for server `getGT` strings. `getGT` can now receive compiler-injected message metadata and prefetch missing translations through the runtime cache in development. `gt-next` forwards the server request conditions into this path so App Router server strings can participate in hot reload translation updates. Compiler-injected `getGT` and `useGT` preload messages now emit the same sugar metadata keys used by runtime lookup options. - 933916e: Store the GT services enabled flag on the i18n config singleton. - 4a5f8e8: Remove unused internal exports and dead utility code. - 083d306: Remove deprecated i18n cache lifecycle hooks and unused cache events. The cache subscription surface now only exposes `translations-cache-miss`, which is used for runtime translation updates. Deprecated lifecycle constructor callbacks and unused locale/dictionary cache hit/miss events have been removed. ## locadex@1.0.186-odysseus.5 ### Patch Changes - Updated dependencies [4a5f8e8] - gt@2.14.51-odysseus.5 ## gt-next@11.0.0-odysseus.10 ### Patch Changes - 432fa49: Use Next.js caching semantics for Cache Components by disabling GT cache expiry and development hot reload runtime translation. Async translation and dictionary lookup boundaries now keep synchronous access to the loaded snapshot, so APIs like `getGT` and `getTranslations` can still resolve strings after cache expiry is delegated to Next.js. Global singleton setup now preserves the first initialized instance instead of replacing it on later initialization attempts. - 07f74f0: Clean up stale package metadata and align TanStack Start package entry points. - 432fa49: Support dev hot reload lookups for server `getGT` strings. `getGT` can now receive compiler-injected message metadata and prefetch missing translations through the runtime cache in development. `gt-next` forwards the server request conditions into this path so App Router server strings can participate in hot reload translation updates. Compiler-injected `getGT` and `useGT` preload messages now emit the same sugar metadata keys used by runtime lookup options. - 33d4be2: Point the `react-server` export condition at the RSC-specific declaration file so TypeScript no longer exposes client-only hooks in React Server Components. - 75dc650: Remove the unused `getDomain` request-function plumbing from `gt-next`. `getDomain` was scaffolded (a throw-only `internal/_getDomain` stub, a `getDomainPath` config prop, a `getDomain` entry in the request-function registry, and a `_GENERALTRANSLATION_CUSTOM_GET_DOMAIN_ENABLED` build env var) but never wired to any runtime consumer — no `getDomain()` request helper exists and nothing reads the env var. Removes the stub module, the `./internal/_getDomain` export, the config prop/registry entries, and the dead env var. `getLocale`/`getRegion` are unchanged. - 8e0a992: Remove the deprecated SSG and experimental-locale-resolution code paths from `gt-next`. Drops the long-deprecated, runtime-dead config surface: `experimentalEnableSSG`, `experimentalLocaleResolution`/`experimentalLocaleResolutionParam`, the static request functions (`STATIC_REQUEST_FUNCTIONS`/`getStatic*` and their non-existent `internal/static/*` aliases), and `disableSSGWarnings`/`getStatic*Path` doc props. Removes `plugin/checks/ssgChecks.ts`, the experimental branch of `cacheComponentsChecks`, the related error/warning builders, and the corresponding build-time env vars (`_GENERALTRANSLATION_ENABLE_SSG`, `_GENERALTRANSLATION_EXPERIMENTAL_LOCALE_RESOLUTION[_PARAM]`, `_GENERALTRANSLATION_STATIC_GET_*_ENABLED`) — none of which were read at runtime. The live cacheComponents checks and `noLocalesCouldBeDeterminedWarning` are retained. - Updated dependencies [432fa49] - Updated dependencies [07f74f0] - Updated dependencies [432fa49] - Updated dependencies [ee34fea] - Updated dependencies [bcba6fd] - Updated dependencies [933916e] - Updated dependencies [b7b3eaf] - Updated dependencies [dfb5fc9] - Updated dependencies [4a5f8e8] - Updated dependencies [288c9f8] - Updated dependencies [083d306] - gt-i18n@1.0.0-odysseus.5 - gt-react@11.0.0-odysseus.10 - @generaltranslation/compiler@1.3.25-odysseus.5 - @generaltranslation/react-core@11.0.0-odysseus.10 ## @generaltranslation/gt-next-lint@15.0.0-odysseus.10 ### Patch Changes - Updated dependencies [432fa49] - Updated dependencies [07f74f0] - Updated dependencies [432fa49] - Updated dependencies [33d4be2] - Updated dependencies [75dc650] - Updated dependencies [8e0a992] - gt-next@11.0.0-odysseus.10 ## gt-node@1.0.0-odysseus.5 ### Patch Changes - Updated dependencies [432fa49] - Updated dependencies [432fa49] - Updated dependencies [933916e] - Updated dependencies [4a5f8e8] - Updated dependencies [083d306] - gt-i18n@1.0.0-odysseus.5 ## gt-react@11.0.0-odysseus.10 ### Patch Changes - 07f74f0: Clean up stale package metadata and align TanStack Start package entry points. - ee34fea: Use the shared runtime environment helper for browser cache dev-mode checks so `gt-react` typechecks without Vite ambient types. - bcba6fd: Fix `useVersionId()` throwing and `useLocaleDirection()` requiring a locale argument in the client and server entrypoints. `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. - 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. - Updated dependencies [432fa49] - Updated dependencies [432fa49] - Updated dependencies [bcba6fd] - Updated dependencies [933916e] - Updated dependencies [b7b3eaf] - Updated dependencies [dfb5fc9] - Updated dependencies [4a5f8e8] - Updated dependencies [288c9f8] - Updated dependencies [083d306] - gt-i18n@1.0.0-odysseus.5 - @generaltranslation/react-core@11.0.0-odysseus.10 ## @generaltranslation/react-core@11.0.0-odysseus.10 ### Patch Changes - bcba6fd: Fix `useVersionId()` throwing and `useLocaleDirection()` requiring a locale argument in the client and server entrypoints. `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. - b7b3eaf: Share render pipeline child renderers with prepared translation rendering. - dfb5fc9: Add portable selector hook return types for React Native declarations. - 4a5f8e8: Remove unused internal exports and dead utility code. - 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. - Updated dependencies [432fa49] - Updated dependencies [432fa49] - Updated dependencies [933916e] - Updated dependencies [4a5f8e8] - Updated dependencies [083d306] - gt-i18n@1.0.0-odysseus.5 ## gt-react-native@11.0.0-odysseus.10 ### Patch Changes - bcba6fd: Fix `useVersionId()` throwing and `useLocaleDirection()` requiring a locale argument in the client and server entrypoints. `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. - dfb5fc9: Add portable selector hook return types for React Native declarations. - Updated dependencies [432fa49] - Updated dependencies [432fa49] - Updated dependencies [bcba6fd] - Updated dependencies [933916e] - Updated dependencies [b7b3eaf] - Updated dependencies [dfb5fc9] - Updated dependencies [4a5f8e8] - Updated dependencies [288c9f8] - Updated dependencies [083d306] - gt-i18n@1.0.0-odysseus.5 - @generaltranslation/react-core@11.0.0-odysseus.10 ## gt-tanstack-start@11.0.0-odysseus.10 ### Patch Changes - 07f74f0: Clean up stale package metadata and align TanStack Start package entry points. - Updated dependencies [432fa49] - Updated dependencies [07f74f0] - Updated dependencies [432fa49] - Updated dependencies [ee34fea] - Updated dependencies [bcba6fd] - Updated dependencies [933916e] - Updated dependencies [b7b3eaf] - Updated dependencies [dfb5fc9] - Updated dependencies [4a5f8e8] - Updated dependencies [288c9f8] - Updated dependencies [083d306] - gt-i18n@1.0.0-odysseus.5 - gt-react@11.0.0-odysseus.10 - @generaltranslation/react-core@11.0.0-odysseus.10 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
## Summary
- Preserve compiler-collected format metadata on useGT/getGT preload
entries.
- Add a regression test for await getGT() with $format: STRING.
## Testing
- pnpm --filter @generaltranslation/compiler test
- pnpm --filter @generaltranslation/compiler typecheck
- pnpm --filter @generaltranslation/compiler format
No changeset added per request.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR fixes a bug where the `format` field was not being included in
the preload metadata injected into `getGT`/`useGT` call expressions
during the compiler's injection pass. It also adds a regression test and
refactors shared test helper logic.
- **`injectCallbackDeclaratorFunctionParameters.ts`**: Adds a `format`
property to the `objectExpression` built for each `translationContent`
entry, matching the same conditional-spread pattern already used for
`id`, `context`, and `maxChars`.
- **`runtimeTranslatePass.test.ts`**: Extracts a reusable
`getObjectPropertyValue` helper, adds a `getPreloadMessageValue` helper
for asserting into the preload array structure, and adds a dedicated
test case verifying `format` is forwarded through the pipeline.
<details open><summary><h3>Confidence Score: 5/5</h3></summary>
Safe to merge — the change is a minimal, well-tested addition of a
missing field to the preload metadata injection.
The production change exactly mirrors the established pattern for other
optional fields and the new test exercises the full compiler pipeline
end-to-end. No existing behaviour is altered; only the previously
dropped `format` field is now forwarded.
No files require special attention. The single style note in the test
helper does not affect correctness.
</details>
<details><summary><h3>Important Files Changed</h3></summary>
| Filename | Overview |
|----------|----------|
|
packages/compiler/src/transform/injection/injectCallbackDeclaratorFunctionParameters.ts
| Adds `format` property injection into the preload metadata object;
follows the identical conditional-spread pattern used for other optional
fields (`id`, `context`, `maxChars`) — correct and minimal. |
| packages/compiler/src/passes/__tests__/runtimeTranslatePass.test.ts |
Adds test coverage for the format field in getGT preload metadata; uses
`expect()` assertions inside a utility helper, which can produce
harder-to-diagnose failure messages when assertions fail mid-helper. |
</details>
<details><summary><h3>Sequence Diagram</h3></summary>
<a href="#gh-light-mode-only">
```mermaid
%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Source as Source File
participant Collection as collectionPass
participant State as TransformState stringCollector
participant Injection as injectionPass
participant AST as Final AST getGT
Source->>Collection: traverse AST
Collection->>State: "store content {hash, message, format, ...}"
Source->>Injection: traverse AST (varDeclarator for getGT)
Injection->>State: getTranslationContent(id)
State-->>Injection: "[{hash, message, format, ...}]"
Injection->>AST: inject arguments as array of objects (now includes format field)
```
</a>
<a href="#gh-dark-mode-only">
```mermaid
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Source as Source File
participant Collection as collectionPass
participant State as TransformState stringCollector
participant Injection as injectionPass
participant AST as Final AST getGT
Source->>Collection: traverse AST
Collection->>State: "store content {hash, message, format, ...}"
Source->>Injection: traverse AST (varDeclarator for getGT)
Injection->>State: getTranslationContent(id)
State-->>Injection: "[{hash, message, format, ...}]"
Injection->>AST: inject arguments as array of objects (now includes format field)
```
</a>
</details>
<a
href="https://app.greptile.com/ide/claude-code?prompt=Fix%20the%20following%201%20code%20review%20issue.%20Work%20through%20them%20one%20at%20a%20time%2C%20proposing%20concise%20fixes.%0A%0A---%0A%0A%23%23%23%20Issue%201%20of%201%0Apackages%2Fcompiler%2Fsrc%2Fpasses%2F__tests__%2FruntimeTranslatePass.test.ts%3A160-169%0AUsing%20%60expect%28%29%60%20inside%20a%20non-test%20utility%20function%20can%20produce%20confusing%20failure%20output%20%E2%80%94%20when%20the%20assertion%20throws%2C%20Jest%2FVitest%20reports%20the%20failure%20site%20as%20being%20inside%20%60getPreloadMessageValue%60%2C%20making%20it%20hard%20to%20tell%20which%20test%20case%20failed%20or%20what%20the%20actual%20received%20value%20was.%20Prefer%20returning%20%60undefined%60%20on%20unexpected%20shapes%20and%20letting%20the%20call-site%20assertions%20fail%20with%20clear%20context.%0A%0A%60%60%60suggestion%0Afunction%20getPreloadMessageValue%28%0A%20%20call%3A%20t.CallExpression%2C%0A%20%20key%3A%20string%0A%29%3A%20string%20%7C%20number%20%7C%20undefined%20%7B%0A%20%20const%20arg%20%3D%20call.arguments%5B0%5D%3B%0A%20%20if%20%28!t.isArrayExpression%28arg%29%29%20return%20undefined%3B%0A%20%20const%20message%20%3D%20%28arg%20as%20t.ArrayExpression%29.elements%5B0%5D%3B%0A%20%20if%20%28!t.isObjectExpression%28message%29%29%20return%20undefined%3B%0A%20%20return%20getObjectPropertyValue%28message%20as%20t.ObjectExpression%2C%20key%29%3B%0A%7D%0A%60%60%60%0A%0A&repo=generaltranslation%2Fgt&pr=1743&platform=github"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInClaudeDark.svg?v=4"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInClaude.svg?v=4"><img
alt="Fix All in Claude Code"
src="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInClaude.svg?v=4"></picture></a>
<a
href="https://app.greptile.com/api/ide/codex?prompt=IMPORTANT%3A%20Work%20in%20the%20repository%20%22generaltranslation%2Fgt%22%20on%20the%20existing%20branch%20%22e%2Fodysseus%2Fgetgt-preload-format%22.%20Checkout%20that%20branch%20%E2%80%94%20do%20NOT%20create%20a%20new%20branch%20or%20open%20a%20new%20PR.%20Push%20your%20changes%20to%20%22e%2Fodysseus%2Fgetgt-preload-format%22.%0A%0AFix%20the%20following%201%20code%20review%20issue.%20Work%20through%20them%20one%20at%20a%20time%2C%20proposing%20concise%20fixes.%0A%0A---%0A%0A%23%23%23%20Issue%201%20of%201%0Apackages%2Fcompiler%2Fsrc%2Fpasses%2F__tests__%2FruntimeTranslatePass.test.ts%3A160-169%0AUsing%20%60expect%28%29%60%20inside%20a%20non-test%20utility%20function%20can%20produce%20confusing%20failure%20output%20%E2%80%94%20when%20the%20assertion%20throws%2C%20Jest%2FVitest%20reports%20the%20failure%20site%20as%20being%20inside%20%60getPreloadMessageValue%60%2C%20making%20it%20hard%20to%20tell%20which%20test%20case%20failed%20or%20what%20the%20actual%20received%20value%20was.%20Prefer%20returning%20%60undefined%60%20on%20unexpected%20shapes%20and%20letting%20the%20call-site%20assertions%20fail%20with%20clear%20context.%0A%0A%60%60%60suggestion%0Afunction%20getPreloadMessageValue%28%0A%20%20call%3A%20t.CallExpression%2C%0A%20%20key%3A%20string%0A%29%3A%20string%20%7C%20number%20%7C%20undefined%20%7B%0A%20%20const%20arg%20%3D%20call.arguments%5B0%5D%3B%0A%20%20if%20%28!t.isArrayExpression%28arg%29%29%20return%20undefined%3B%0A%20%20const%20message%20%3D%20%28arg%20as%20t.ArrayExpression%29.elements%5B0%5D%3B%0A%20%20if%20%28!t.isObjectExpression%28message%29%29%20return%20undefined%3B%0A%20%20return%20getObjectPropertyValue%28message%20as%20t.ObjectExpression%2C%20key%29%3B%0A%7D%0A%60%60%60%0A%0A&repo=generaltranslation%2Fgt&pr=1743&platform=github"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCodexDark.svg?v=4"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCodex.svg?v=4"><img
alt="Fix All in Codex"
src="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCodex.svg?v=4"></picture></a>
<details><summary>Prompt To Fix All With AI</summary>
`````markdown
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
packages/compiler/src/passes/__tests__/runtimeTranslatePass.test.ts:160-169
Using `expect()` inside a non-test utility function can produce confusing failure output — when the assertion throws, Jest/Vitest reports the failure site as being inside `getPreloadMessageValue`, making it hard to tell which test case failed or what the actual received value was. Prefer returning `undefined` on unexpected shapes and letting the call-site assertions fail with clear context.
```suggestion
function getPreloadMessageValue(
call: t.CallExpression,
key: string
): string | number | undefined {
const arg = call.arguments[0];
if (!t.isArrayExpression(arg)) return undefined;
const message = (arg as t.ArrayExpression).elements[0];
if (!t.isObjectExpression(message)) return undefined;
return getObjectPropertyValue(message as t.ObjectExpression, key);
}
```
`````
</details>
<sub>Reviews (1): Last reviewed commit: ["fix: preserve getgt preload
format"](1b510b4)
| [Re-trigger
Greptile](https://app.greptile.com/api/retrigger?id=41002805)</sub>
> Greptile also left **1 inline comment** on this PR.
<!-- /greptile_comment -->
## Summary
- Stop passing `locale={false}` through to `next/link` after
`gt-next/link` localizes hrefs.
- Add regression coverage that verifies localized links do not forward
`locale` to the underlying Link component.
## Testing
- `pnpm exec oxfmt --check packages/next/src/link/Link.tsx
packages/next/src/link/__tests__/Link.test.tsx`
- `pnpm exec oxlint packages/next/src/link/Link.tsx
packages/next/src/link/__tests__/Link.test.tsx`
- `pnpm --filter gt-next typecheck`
- `pnpm --filter gt-next exec vitest run
src/link/__tests__/Link.test.tsx`
- `pnpm --filter gt-next test:js`
- `pnpm --filter gt-next build:no-swc-plugin`
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR removes the explicit `locale={false}` forwarding to `next/link`
after `gt-next/link` has already localized the href, and adds a
regression test to verify the behavior. The `locale` prop is a Pages
Router i18n feature that is not supported (and could produce warnings)
in the Next.js App Router.
- `renderLink` now omits `locale` entirely from the props passed to
`NextLink`; since `locale` is already destructured out of
`ResolvedLinkProps`, the fix is achieved by simply dropping the explicit
`locale={false}` override.
- Two vitest cases are added: one for the default path (locale
auto-detected from `useLocale`) and one for the opt-out path
(`locale={false}`), both asserting that `locale` does not appear on the
rendered `NextLink` props.
<details open><summary><h3>Confidence Score: 5/5</h3></summary>
Safe to merge — the change is a one-line removal of a prop that was
already redundant and could cause warnings in App Router.
The `locale` prop was already being destructured out of
`ResolvedLinkProps` before `...props` was spread, so the explicit
`locale={false}` override was the only way it reached `NextLink`.
Removing it is a clean, correct fix. The new tests cover both the
default-locale and opt-out paths and confirm `locale` does not appear on
the rendered `NextLink` props.
No files require special attention.
</details>
<details><summary><h3>Important Files Changed</h3></summary>
| Filename | Overview |
|----------|----------|
| packages/next/src/link/Link.tsx | Removes the explicit
`locale={false}` prop forwarded to NextLink; locale is already
destructured out and localizeHref handles all prefixing, so the fix is
correct and minimal. |
| packages/next/src/link/__tests__/Link.test.tsx | New test file with
two cases covering the default locale and locale=false paths; mock setup
and assertions correctly validate that locale is not forwarded to
NextLink. |
</details>
<details><summary><h3>Sequence Diagram</h3></summary>
<a href="#gh-light-mode-only">
```mermaid
%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant User as User Code
participant GTLink as gt-next Link
participant renderLink as renderLink
participant localizeHref as localizeHref
participant NextLink as next/link
User->>GTLink: "href="/home""
GTLink->>GTLink: "locale = useLocale() returns "fr""
GTLink->>renderLink: "href="/home", locale="fr", ...props"
renderLink->>localizeHref: "/home", "fr"
localizeHref-->>renderLink: "/fr/home"
renderLink->>NextLink: "href="/fr/home", ...props (locale omitted)"
User->>GTLink: "href="/legal", locale=false"
GTLink->>renderLink: "href="/legal", locale=false, ...props"
renderLink->>localizeHref: "/legal", false
localizeHref-->>renderLink: "/legal" unchanged
renderLink->>NextLink: "href="/legal", ...props (locale omitted)"
```
</a>
<a href="#gh-dark-mode-only">
```mermaid
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant User as User Code
participant GTLink as gt-next Link
participant renderLink as renderLink
participant localizeHref as localizeHref
participant NextLink as next/link
User->>GTLink: "href="/home""
GTLink->>GTLink: "locale = useLocale() returns "fr""
GTLink->>renderLink: "href="/home", locale="fr", ...props"
renderLink->>localizeHref: "/home", "fr"
localizeHref-->>renderLink: "/fr/home"
renderLink->>NextLink: "href="/fr/home", ...props (locale omitted)"
User->>GTLink: "href="/legal", locale=false"
GTLink->>renderLink: "href="/legal", locale=false, ...props"
renderLink->>localizeHref: "/legal", false
localizeHref-->>renderLink: "/legal" unchanged
renderLink->>NextLink: "href="/legal", ...props (locale omitted)"
```
</a>
</details>
<sub>Reviews (1): Last reviewed commit: ["fix: stop forwarding locale
prop from
ne..."](69b133c)
| [Re-trigger
Greptile](https://app.greptile.com/api/retrigger?id=41022058)</sub>
<!-- /greptile_comment -->
## Summary\n- make sync `t()` honor the writable condition store's
`enableI18n` flag\n- return source/default-locale output when i18n is
disabled\n- update `t` tests for the condition-store shape and disabled
behavior\n\n## Checks\n- `pnpm --filter gt-i18n typecheck`\n- `pnpm
--filter gt-i18n test -- --runInBand`
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR fixes the synchronous `t()` function to honour the `enableI18n`
flag from the writable condition store, mirroring the guard already
present in async helpers like `getTranslations`, `getMessages`, and
`getGT`. When i18n is disabled both the string-overload and
tagged-template-literal code paths now fall back to
`getDefaultLocale()`, returning source-language output instead of a
translation.
- **`t.ts`**: The condition store is now fetched once per call;
`getEnableI18n()` gates locale resolution in both `t()` and
`handleTaggedTemplateLiteralTranslation()`, and the now-unused
`getLocale` import is replaced with `getDefaultLocale`.
- **`t.test.ts`**: All existing mocks are updated to include
`getEnableI18n`, and a new test asserts that source output is returned
when i18n is disabled — though only for the string overload; the
tagged-template-literal disabled branch has no dedicated test.
<details open><summary><h3>Confidence Score: 4/5</h3></summary>
Safe to merge; the core logic change is straightforward and consistent
with how other translation helpers already handle the enableI18n flag.
Both code paths in t.ts are correctly guarded, and the implementation
matches the existing pattern in the async helpers. The only gap is a
missing test for the tagged-template-literal branch when i18n is
disabled — the feature works, but a future regression there would go
undetected by the suite.
t.test.ts — the tagged-template-literal disabled-i18n scenario has no
test coverage.
</details>
<details><summary><h3>Important Files Changed</h3></summary>
| Filename | Overview |
|----------|----------|
| packages/i18n/src/translation-functions/t.ts | Adds enableI18n guard
to both the string and tagged-template-literal code paths; drops unused
getLocale import and reads the condition store once per call. |
| packages/i18n/src/translation-functions/__tests__/t.test.ts | Updates
all existing mocks to include getEnableI18n and adds a new test for the
disabled-i18n string branch; the tagged-template-literal disabled case
is untested. |
</details>
<details><summary><h3>Flowchart</h3></summary>
<a href="#gh-light-mode-only">
```mermaid
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[t called] --> B{string or template?}
B -->|string| C[get conditionStore]
B -->|template| D[get conditionStore]
C --> E{enableI18n?}
E -->|true| G[use explicit locale or conditionStore locale]
E -->|false| H[use defaultLocale]
D --> F{enableI18n?}
F -->|true| I[use conditionStore locale]
F -->|false| J[use defaultLocale]
G --> K[resolveStringContentWithFallback]
H --> K
I --> L[resolveStringContent with fallback]
J --> L
K --> M[return string]
L --> M
```
</a>
<a href="#gh-dark-mode-only">
```mermaid
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[t called] --> B{string or template?}
B -->|string| C[get conditionStore]
B -->|template| D[get conditionStore]
C --> E{enableI18n?}
E -->|true| G[use explicit locale or conditionStore locale]
E -->|false| H[use defaultLocale]
D --> F{enableI18n?}
F -->|true| I[use conditionStore locale]
F -->|false| J[use defaultLocale]
G --> K[resolveStringContentWithFallback]
H --> K
I --> L[resolveStringContent with fallback]
J --> L
K --> M[return string]
L --> M
```
</a>
</details>
<a
href="https://app.greptile.com/ide/claude-code?prompt=Fix%20the%20following%201%20code%20review%20issue.%20Work%20through%20them%20one%20at%20a%20time%2C%20proposing%20concise%20fixes.%0A%0A---%0A%0A%23%23%23%20Issue%201%20of%201%0Apackages%2Fi18n%2Fsrc%2Ftranslation-functions%2F__tests__%2Ft.test.ts%3A164-183%0A**Missing%20disabled-i18n%20test%20for%20the%20tagged-template%20branch**%0A%0AThe%20new%20%60'returns%20the%20source%20when%20i18n%20is%20disabled'%60%20test%20only%20exercises%20the%20string%20overload%20%28%60t%28message%2C%20options%29%60%29.%20%60handleTaggedTemplateLiteralTranslation%60%20received%20the%20same%20%60getEnableI18n%28%29%60%20gate%2C%20but%20there%20is%20no%20corresponding%20test%20that%20calls%20%60%60%20t%60Hello%20%24%7Bname%7D!%60%20%60%60%20with%20%60getEnableI18n%3A%20%28%29%20%3D%3E%20false%60.%20If%20a%20regression%20is%20introduced%20in%20that%20branch%2C%20the%20suite%20will%20not%20catch%20it.%0A%0A&repo=generaltranslation%2Fgt&pr=1744&platform=github"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInClaudeDark.svg?v=4"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInClaude.svg?v=4"><img
alt="Fix All in Claude Code"
src="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInClaude.svg?v=4"></picture></a>
<a
href="https://app.greptile.com/api/ide/codex?prompt=IMPORTANT%3A%20Work%20in%20the%20repository%20%22generaltranslation%2Fgt%22%20on%20the%20existing%20branch%20%22bg%2Fenable-i18n-t-disabled%22.%20Checkout%20that%20branch%20%E2%80%94%20do%20NOT%20create%20a%20new%20branch%20or%20open%20a%20new%20PR.%20Push%20your%20changes%20to%20%22bg%2Fenable-i18n-t-disabled%22.%0A%0AFix%20the%20following%201%20code%20review%20issue.%20Work%20through%20them%20one%20at%20a%20time%2C%20proposing%20concise%20fixes.%0A%0A---%0A%0A%23%23%23%20Issue%201%20of%201%0Apackages%2Fi18n%2Fsrc%2Ftranslation-functions%2F__tests__%2Ft.test.ts%3A164-183%0A**Missing%20disabled-i18n%20test%20for%20the%20tagged-template%20branch**%0A%0AThe%20new%20%60'returns%20the%20source%20when%20i18n%20is%20disabled'%60%20test%20only%20exercises%20the%20string%20overload%20%28%60t%28message%2C%20options%29%60%29.%20%60handleTaggedTemplateLiteralTranslation%60%20received%20the%20same%20%60getEnableI18n%28%29%60%20gate%2C%20but%20there%20is%20no%20corresponding%20test%20that%20calls%20%60%60%20t%60Hello%20%24%7Bname%7D!%60%20%60%60%20with%20%60getEnableI18n%3A%20%28%29%20%3D%3E%20false%60.%20If%20a%20regression%20is%20introduced%20in%20that%20branch%2C%20the%20suite%20will%20not%20catch%20it.%0A%0A&repo=generaltranslation%2Fgt&pr=1744&platform=github"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCodexDark.svg?v=4"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCodex.svg?v=4"><img
alt="Fix All in Codex"
src="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCodex.svg?v=4"></picture></a>
<details><summary>Prompt To Fix All With AI</summary>
`````markdown
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
packages/i18n/src/translation-functions/__tests__/t.test.ts:164-183
**Missing disabled-i18n test for the tagged-template branch**
The new `'returns the source when i18n is disabled'` test only exercises the string overload (`t(message, options)`). `handleTaggedTemplateLiteralTranslation` received the same `getEnableI18n()` gate, but there is no corresponding test that calls `` t`Hello ${name}!` `` with `getEnableI18n: () => false`. If a regression is introduced in that branch, the suite will not catch it.
`````
</details>
<sub>Reviews (1): Last reviewed commit: ["fix: respect disabled i18n in
t"](8c74826)
| [Re-trigger
Greptile](https://app.greptile.com/api/retrigger?id=41005495)</sub>
> Greptile also left **1 inline comment** on this PR.
<!-- /greptile_comment -->
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to odysseus, this PR will be updated.⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ `odysseus` is currently in **pre mode** so this branch has prereleases rather than normal releases. If you want to exit prereleases, run `changeset pre exit` on `odysseus`.⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ # Releases ## @generaltranslation/compiler@1.3.25-odysseus.6 ### Patch Changes - c34cab3: Preserve `$format` in compiler-injected `getGT` and `useGT` preload metadata so preloaded runtime lookups use the same hash format as the original translation call. ## gt-next@11.0.0-odysseus.11 ### Patch Changes - fe7dfd3: Stop forwarding `locale={false}` from `gt-next/link` to the underlying Next.js link after localizing the href. This avoids React DOM warnings in newer Next.js versions where the control prop can reach the rendered anchor. - Updated dependencies [c34cab3] - @generaltranslation/compiler@1.3.25-odysseus.6 - @generaltranslation/react-core@11.0.0-odysseus.11 - gt-react@11.0.0-odysseus.11 ## @generaltranslation/gt-next-lint@15.0.0-odysseus.11 ### Patch Changes - Updated dependencies [fe7dfd3] - gt-next@11.0.0-odysseus.11 ## gt-react@11.0.0-odysseus.11 ### Patch Changes - @generaltranslation/react-core@11.0.0-odysseus.11 ## gt-react-native@11.0.0-odysseus.11 ### Patch Changes - @generaltranslation/react-core@11.0.0-odysseus.11 ## gt-tanstack-start@11.0.0-odysseus.11 ### Patch Changes - @generaltranslation/react-core@11.0.0-odysseus.11 - gt-react@11.0.0-odysseus.11 ## @generaltranslation/react-core@11.0.0-odysseus.11 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
## Summary
- replace repeated determineLocale/defaultLocale fallback code with
resolveSupportedLocale
- keep behavior equivalent while reducing repeated locale resolution
logic
## Verification
- pnpm --filter gt-react test -- BrowserConditionStore
- pnpm --filter gt-react typecheck
- pnpm --filter gt-react-native typecheck
- pnpm --filter gt-node typecheck
- pnpm --filter gt-i18n typecheck
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR consolidates the repeated `determineLocale(x) ||
getDefaultLocale()` two-step fallback pattern into a single call to
`resolveSupportedLocale`, which encapsulates the same logic inside
`I18nConfig`. The change touches six production files across the
`gt-i18n`, `gt-node`, `gt-react`, and `gt-react-native` packages plus
the matching test mock.
- The refactor is behaviorally equivalent: `resolveSupportedLocale`
delegates to `determineSupportedLocaleWithConfig` (which calls the same
`determineLocale` path) and falls back to `defaultLocale`, mirroring the
old pattern exactly.
- The `resolveLocale` private helper in `createBrowserConditionStore.ts`
is correctly inlined away since it was a one-liner wrapping the old
pattern.
- The test mock retains the now-unused `determineLocale` and
`getDefaultLocale` stubs; trimming them would keep the mock in sync with
what the code actually exercises.
<details open><summary><h3>Confidence Score: 5/5</h3></summary>
Safe to merge — the refactor is a mechanical substitution of an
equivalent one-liner across six files with no logic changes.
Every changed call site replaces a two-step fallback with
resolveSupportedLocale, which internally performs the same
determineLocale-then-defaultLocale logic, confirmed by reading
I18nConfig. The only finding is dead stubs in the test mock.
The test mock in BrowserConditionStore.test.ts retains stubs that are no
longer called; worth tidying but not a blocker.
</details>
<details><summary><h3>Important Files Changed</h3></summary>
| Filename | Overview |
|----------|----------|
| packages/i18n/src/condition-store/ReadonlyConditionStore.ts | Replaces
two-step determineLocale+getDefaultLocale fallback with
resolveSupportedLocale; behaviorally equivalent. |
| packages/i18n/src/condition-store/WritableConditionStore.ts | Same
single-line refactor in setLocale; no behavioral change. |
| packages/node/src/async-i18n-cache/AsyncConditionStore.ts | Local
resolveLocale helper simplified to one line using
resolveSupportedLocale; equivalent logic. |
| packages/react-native/src/utils/resolveLocale.ts | resolveLocale
utility simplified; null coalescing to undefined preserved, behavior
unchanged. |
| packages/react/src/condition-store/BrowserConditionStore.ts | Three
call sites updated in constructor, updateLocale, and getBrowserLocale;
all equivalent to prior pattern. |
|
packages/react/src/condition-store/__tests__/BrowserConditionStore.test.ts
| Adds resolveSupportedLocale to the mock; retains now-unused
determineLocale and getDefaultLocale stubs. |
| packages/react/src/condition-store/createBrowserConditionStore.ts |
Removes the now-redundant resolveLocale private helper; determineLocale
inlines the call directly. |
</details>
<details><summary><h3>Sequence Diagram</h3></summary>
<a href="#gh-light-mode-only">
```mermaid
%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Caller
participant ConditionStore
participant I18nConfig
Note over Caller,I18nConfig: Before (old pattern)
Caller->>ConditionStore: setLocale(locale)
ConditionStore->>I18nConfig: determineLocale(locale)
I18nConfig-->>ConditionStore: "string | undefined"
alt undefined
ConditionStore->>I18nConfig: getDefaultLocale()
I18nConfig-->>ConditionStore: defaultLocale
end
ConditionStore-->>Caller: resolved locale
Note over Caller,I18nConfig: After (new pattern)
Caller->>ConditionStore: setLocale(locale)
ConditionStore->>I18nConfig: resolveSupportedLocale(locale)
I18nConfig->>I18nConfig: determineSupportedLocaleWithConfig(candidates, this)
I18nConfig->>I18nConfig: determineLocale(candidates) OR defaultLocale
I18nConfig-->>ConditionStore: string (never undefined)
ConditionStore-->>Caller: resolved locale
```
</a>
<a href="#gh-dark-mode-only">
```mermaid
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Caller
participant ConditionStore
participant I18nConfig
Note over Caller,I18nConfig: Before (old pattern)
Caller->>ConditionStore: setLocale(locale)
ConditionStore->>I18nConfig: determineLocale(locale)
I18nConfig-->>ConditionStore: "string | undefined"
alt undefined
ConditionStore->>I18nConfig: getDefaultLocale()
I18nConfig-->>ConditionStore: defaultLocale
end
ConditionStore-->>Caller: resolved locale
Note over Caller,I18nConfig: After (new pattern)
Caller->>ConditionStore: setLocale(locale)
ConditionStore->>I18nConfig: resolveSupportedLocale(locale)
I18nConfig->>I18nConfig: determineSupportedLocaleWithConfig(candidates, this)
I18nConfig->>I18nConfig: determineLocale(candidates) OR defaultLocale
I18nConfig-->>ConditionStore: string (never undefined)
ConditionStore-->>Caller: resolved locale
```
</a>
</details>
<!-- greptile_failed_comments -->
<details open><summary><h3>Comments Outside Diff (1)</h3></summary>
1.
`packages/react/src/condition-store/__tests__/BrowserConditionStore.test.ts`,
line 10-21
([link](https://github.com/generaltranslation/gt/blob/602339b6c47568cbb07904df5fbe6c894344e091/packages/react/src/condition-store/__tests__/BrowserConditionStore.test.ts#L10-L21))
<a href="#"><img alt="P2"
src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9"
align="top"></a> After the refactor, `BrowserConditionStore` no longer
calls `determineLocale` or `getDefaultLocale` — only
`resolveSupportedLocale` is invoked. Leaving the unused stubs in the
mock is harmless but creates noise for future readers who may expect
these methods to be exercised.
<details><summary>Prompt To Fix With AI</summary>
`````markdown
This is a comment left during a code review.
Path:
packages/react/src/condition-store/__tests__/BrowserConditionStore.test.ts
Line: 10-21
Comment:
After the refactor, `BrowserConditionStore` no longer calls
`determineLocale` or `getDefaultLocale` — only `resolveSupportedLocale`
is invoked. Leaving the unused stubs in the mock is harmless but creates
noise for future readers who may expect these methods to be exercised.
How can I resolve this? If you propose a fix, please make it concise.
`````
</details>
Note: If this suggestion doesn't match your team's coding style, reply
to this and let me know. I'll remember it for next time!
<a
href="https://app.greptile.com/ide/claude-code?prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0APath%3A%20packages%2Freact%2Fsrc%2Fcondition-store%2F__tests__%2FBrowserConditionStore.test.ts%0ALine%3A%2010-21%0A%0AComment%3A%0AAfter%20the%20refactor%2C%20%60BrowserConditionStore%60%20no%20longer%20calls%20%60determineLocale%60%20or%20%60getDefaultLocale%60%20%E2%80%94%20only%20%60resolveSupportedLocale%60%20is%20invoked.%20Leaving%20the%20unused%20stubs%20in%20the%20mock%20is%20harmless%20but%20creates%20noise%20for%20future%20readers%20who%20may%20expect%20these%20methods%20to%20be%20exercised.%0A%0A%60%60%60suggestion%0Avi.mock%28'gt-i18n%2Finternal'%2C%20%28%29%20%3D%3E%20%28%7B%0A%20%20getI18nConfig%3A%20%28%29%20%3D%3E%20%28%7B%0A%20%20%20%20resolveSupportedLocale%3A%20%28locale%3F%3A%20string%20%7C%20string%5B%5D%29%20%3D%3E%20%7B%0A%20%20%20%20%20%20const%20resolved%20%3D%20Array.isArray%28locale%29%20%3F%20locale%5B0%5D%20%3A%20locale%3B%0A%20%20%20%20%20%20return%20resolved%20%7C%7C%20'en'%3B%0A%20%20%20%20%7D%2C%0A%20%20%7D%29%2C%0A%7D%29%29%3B%0A%60%60%60%0A%0AHow%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20please%20make%20it%20concise.&repo=generaltranslation%2Fgt&pr=1750&platform=github"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaudeDark.svg?v=4"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaude.svg?v=4"><img
alt="Fix in Claude Code"
src="https://greptile-static-assets.s3.amazonaws.com/badges/FixInClaude.svg?v=4"></picture></a>
<a
href="https://app.greptile.com/api/ide/codex?prompt=IMPORTANT%3A%20Work%20in%20the%20repository%20%22generaltranslation%2Fgt%22%20on%20the%20existing%20branch%20%22bg%2Fodysseus-resolve-supported-locale%22.%20Checkout%20that%20branch%20%E2%80%94%20do%20NOT%20create%20a%20new%20branch%20or%20open%20a%20new%20PR.%20Push%20your%20changes%20to%20%22bg%2Fodysseus-resolve-supported-locale%22.%0A%0AThis%20is%20a%20comment%20left%20during%20a%20code%20review.%0APath%3A%20packages%2Freact%2Fsrc%2Fcondition-store%2F__tests__%2FBrowserConditionStore.test.ts%0ALine%3A%2010-21%0A%0AComment%3A%0AAfter%20the%20refactor%2C%20%60BrowserConditionStore%60%20no%20longer%20calls%20%60determineLocale%60%20or%20%60getDefaultLocale%60%20%E2%80%94%20only%20%60resolveSupportedLocale%60%20is%20invoked.%20Leaving%20the%20unused%20stubs%20in%20the%20mock%20is%20harmless%20but%20creates%20noise%20for%20future%20readers%20who%20may%20expect%20these%20methods%20to%20be%20exercised.%0A%0A%60%60%60suggestion%0Avi.mock%28'gt-i18n%2Finternal'%2C%20%28%29%20%3D%3E%20%28%7B%0A%20%20getI18nConfig%3A%20%28%29%20%3D%3E%20%28%7B%0A%20%20%20%20resolveSupportedLocale%3A%20%28locale%3F%3A%20string%20%7C%20string%5B%5D%29%20%3D%3E%20%7B%0A%20%20%20%20%20%20const%20resolved%20%3D%20Array.isArray%28locale%29%20%3F%20locale%5B0%5D%20%3A%20locale%3B%0A%20%20%20%20%20%20return%20resolved%20%7C%7C%20'en'%3B%0A%20%20%20%20%7D%2C%0A%20%20%7D%29%2C%0A%7D%29%29%3B%0A%60%60%60%0A%0AHow%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20please%20make%20it%20concise.&repo=generaltranslation%2Fgt&pr=1750&platform=github"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCodexDark.svg?v=4"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCodex.svg?v=4"><img
alt="Fix in Codex"
src="https://greptile-static-assets.s3.amazonaws.com/badges/FixInCodex.svg?v=4"></picture></a>
</details>
<!-- /greptile_failed_comments -->
<a
href="https://app.greptile.com/ide/claude-code?prompt=Fix%20the%20following%201%20code%20review%20issue.%20Work%20through%20them%20one%20at%20a%20time%2C%20proposing%20concise%20fixes.%0A%0A---%0A%0A%23%23%23%20Issue%201%20of%201%0Apackages%2Freact%2Fsrc%2Fcondition-store%2F__tests__%2FBrowserConditionStore.test.ts%3A10-21%0AAfter%20the%20refactor%2C%20%60BrowserConditionStore%60%20no%20longer%20calls%20%60determineLocale%60%20or%20%60getDefaultLocale%60%20%E2%80%94%20only%20%60resolveSupportedLocale%60%20is%20invoked.%20Leaving%20the%20unused%20stubs%20in%20the%20mock%20is%20harmless%20but%20creates%20noise%20for%20future%20readers%20who%20may%20expect%20these%20methods%20to%20be%20exercised.%0A%0A%60%60%60suggestion%0Avi.mock%28'gt-i18n%2Finternal'%2C%20%28%29%20%3D%3E%20%28%7B%0A%20%20getI18nConfig%3A%20%28%29%20%3D%3E%20%28%7B%0A%20%20%20%20resolveSupportedLocale%3A%20%28locale%3F%3A%20string%20%7C%20string%5B%5D%29%20%3D%3E%20%7B%0A%20%20%20%20%20%20const%20resolved%20%3D%20Array.isArray%28locale%29%20%3F%20locale%5B0%5D%20%3A%20locale%3B%0A%20%20%20%20%20%20return%20resolved%20%7C%7C%20'en'%3B%0A%20%20%20%20%7D%2C%0A%20%20%7D%29%2C%0A%7D%29%29%3B%0A%60%60%60%0A%0A&repo=generaltranslation%2Fgt&pr=1750&platform=github"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInClaudeDark.svg?v=4"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInClaude.svg?v=4"><img
alt="Fix All in Claude Code"
src="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInClaude.svg?v=4"></picture></a>
<a
href="https://app.greptile.com/api/ide/codex?prompt=IMPORTANT%3A%20Work%20in%20the%20repository%20%22generaltranslation%2Fgt%22%20on%20the%20existing%20branch%20%22bg%2Fodysseus-resolve-supported-locale%22.%20Checkout%20that%20branch%20%E2%80%94%20do%20NOT%20create%20a%20new%20branch%20or%20open%20a%20new%20PR.%20Push%20your%20changes%20to%20%22bg%2Fodysseus-resolve-supported-locale%22.%0A%0AFix%20the%20following%201%20code%20review%20issue.%20Work%20through%20them%20one%20at%20a%20time%2C%20proposing%20concise%20fixes.%0A%0A---%0A%0A%23%23%23%20Issue%201%20of%201%0Apackages%2Freact%2Fsrc%2Fcondition-store%2F__tests__%2FBrowserConditionStore.test.ts%3A10-21%0AAfter%20the%20refactor%2C%20%60BrowserConditionStore%60%20no%20longer%20calls%20%60determineLocale%60%20or%20%60getDefaultLocale%60%20%E2%80%94%20only%20%60resolveSupportedLocale%60%20is%20invoked.%20Leaving%20the%20unused%20stubs%20in%20the%20mock%20is%20harmless%20but%20creates%20noise%20for%20future%20readers%20who%20may%20expect%20these%20methods%20to%20be%20exercised.%0A%0A%60%60%60suggestion%0Avi.mock%28'gt-i18n%2Finternal'%2C%20%28%29%20%3D%3E%20%28%7B%0A%20%20getI18nConfig%3A%20%28%29%20%3D%3E%20%28%7B%0A%20%20%20%20resolveSupportedLocale%3A%20%28locale%3F%3A%20string%20%7C%20string%5B%5D%29%20%3D%3E%20%7B%0A%20%20%20%20%20%20const%20resolved%20%3D%20Array.isArray%28locale%29%20%3F%20locale%5B0%5D%20%3A%20locale%3B%0A%20%20%20%20%20%20return%20resolved%20%7C%7C%20'en'%3B%0A%20%20%20%20%7D%2C%0A%20%20%7D%29%2C%0A%7D%29%29%3B%0A%60%60%60%0A%0A&repo=generaltranslation%2Fgt&pr=1750&platform=github"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCodexDark.svg?v=4"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCodex.svg?v=4"><img
alt="Fix All in Codex"
src="https://greptile-static-assets.s3.amazonaws.com/badges/FixAllInCodex.svg?v=4"></picture></a>
<details><summary>Prompt To Fix All With AI</summary>
`````markdown
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
packages/react/src/condition-store/__tests__/BrowserConditionStore.test.ts:10-21
After the refactor, `BrowserConditionStore` no longer calls `determineLocale` or `getDefaultLocale` — only `resolveSupportedLocale` is invoked. Leaving the unused stubs in the mock is harmless but creates noise for future readers who may expect these methods to be exercised.
```suggestion
vi.mock('gt-i18n/internal', () => ({
getI18nConfig: () => ({
resolveSupportedLocale: (locale?: string | string[]) => {
const resolved = Array.isArray(locale) ? locale[0] : locale;
return resolved || 'en';
},
}),
}));
```
`````
</details>
<sub>Reviews (1): Last reviewed commit: ["refactor: use supported locale
resolver"](602339b)
| [Re-trigger
Greptile](https://app.greptile.com/api/retrigger?id=41016695)</sub>
<!-- /greptile_comment -->
## Summary
- replace React Native server-render initializeGT implementation with
the shared react-core implementation
- preserve the exported InitializeGTParams type
## Verification
- pnpm --filter gt-react-native typecheck
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR removes the duplicated `initializeGT` implementation in the
React Native package and replaces it with a re-export of
`internalInitializeGTSRA` from `@generaltranslation/react-core/pure`,
which is already exported from that module under both names. The public
`InitializeGTParams` type and the `initializeGT` function name are fully
preserved.
- The two implementations were byte-for-byte identical
(`initializeI18nConfig(config, 'server-render')` + `new
ReactI18nCache(config)` + `setReactI18nCache`), so the change is a pure
deduplication with no behavioral difference.
- `InitializeGTParams` continues to be exported as `I18nConfigParams &
ReactI18nCacheParams`, matching the parameter type of
`internalInitializeGTSRA`, so the public API is unchanged.
<details open><summary><h3>Confidence Score: 5/5</h3></summary>
Safe to merge — the change is a pure deduplication with no behavioral
difference and the public API is fully preserved.
The deleted inline implementation and the re-exported
internalInitializeGTSRA perform exactly the same two steps in the same
order, and internalInitializeGTSRA is already a stable export of
react-core/pure. The InitializeGTParams type and the initializeGT name
are both preserved, so no downstream consumer needs to change.
No files require special attention.
</details>
<details><summary><h3>Important Files Changed</h3></summary>
| Filename | Overview |
|----------|----------|
| packages/react-native/src/setup/initializeGT.ts | Replaces the inline
implementation of initializeGT with a direct re-export of
internalInitializeGTSRA from react-core/pure; preserves the exported
InitializeGTParams type; the two implementations are byte-for-byte
identical so no behavior changes. |
</details>
<details><summary><h3>Sequence Diagram</h3></summary>
<a href="#gh-light-mode-only">
```mermaid
%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Caller as React Native caller
participant File as initializeGT.ts (react-native)
participant Core as react-core/pure (internalInitializeGTSRA)
participant I18nConfig as initializeI18nConfig
participant Cache as ReactI18nCache / setReactI18nCache
Caller->>File: initializeGT(config)
Note over File: re-export → delegates immediately
File->>Core: internalInitializeGTSRA(config)
Core->>I18nConfig: initializeI18nConfig(config, 'server-render')
Core->>Cache: new ReactI18nCache(config)
Core->>Cache: setReactI18nCache(i18nCache)
```
</a>
<a href="#gh-dark-mode-only">
```mermaid
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Caller as React Native caller
participant File as initializeGT.ts (react-native)
participant Core as react-core/pure (internalInitializeGTSRA)
participant I18nConfig as initializeI18nConfig
participant Cache as ReactI18nCache / setReactI18nCache
Caller->>File: initializeGT(config)
Note over File: re-export → delegates immediately
File->>Core: internalInitializeGTSRA(config)
Core->>I18nConfig: initializeI18nConfig(config, 'server-render')
Core->>Cache: new ReactI18nCache(config)
Core->>Cache: setReactI18nCache(i18nCache)
```
</a>
</details>
<sub>Reviews (1): Last reviewed commit: ["refactor: reuse react core
initializeGT"](4027d1c)
| [Re-trigger
Greptile](https://app.greptile.com/api/retrigger?id=41016618)</sub>
<!-- /greptile_comment -->
## Summary
- consolidate duplicated TanStack Start entrypoint exports through a
shared barrel
- keep the client entrypoint as the only source file with the use-client
directive
- remove the redundant react-server export condition that already
matched the server fallback
- add a patch changeset for gt-tanstack-start
## Checks
- pnpm --filter gt-tanstack-start typecheck
- pnpm --filter gt-tanstack-start build
- pnpm --filter gt-tanstack-start test
- pnpm format
- git diff --check
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR consolidates the three `gt-tanstack-start` source entrypoints
(`index.client.ts`, `index.server.ts`, `index.types.ts`) into a single
`index.ts` barrel, relying on `gt-react`'s existing `browser` and
`react-server` export conditions to handle the client/server boundary
rather than duplicating them at the `gt-tanstack-start` level.
- **Barrel consolidation**: `index.server.ts` is renamed to `index.ts`
(content unchanged); the `index.client.ts` (which had the `'use client'`
directive) and `index.types.ts` (type-only duplicate) are deleted.
- **Package.json simplification**: The `react-server` and `browser`
export conditions are removed from `gt-tanstack-start`'s exports — both
were effectively redundant because `gt-react` (which is never bundled
into this package) already declares those conditions on its own built
artifacts, so bundlers pick up `gt-react`'s `'use client'` markers
transitively.
- **Size-limit update**: The two separate client and server size-limit
entries are collapsed into a single `tanstack('gt-tanstack-start',
'index')` check at the same 52 kB ceiling.
<details open><summary><h3>Confidence Score: 5/5</h3></summary>
Safe to merge — this is a pure structural refactor with no logic or API
changes.
The deleted files (index.client.ts, index.types.ts) were exact
duplicates of what the surviving index.ts (renamed from index.server.ts)
already exports, just with different directives. The removed browser and
react-server export conditions on gt-tanstack-start were redundant
because gt-react is never bundled into this package and already declares
those conditions on its own built artifacts — Vite/Vinxi apply export
conditions build-wide, so gt-react's 'use client' markers are still
visible to the RSC transform. No runtime behavior changes.
No files require special attention.
</details>
<details><summary><h3>Important Files Changed</h3></summary>
| Filename | Overview |
|----------|----------|
| packages/tanstack-start/src/index.ts | Renamed from index.server.ts
with no content changes; now the sole barrel re-exporting gt-react
symbols |
| packages/tanstack-start/package.json | Removes react-server and
browser export conditions (both were redundant given gt-react's own
conditions); consolidates main/module/types to index.* |
| packages/tanstack-start/tsdown.config.mts | Reduces entry list from
three files to a single src/index.ts; no logic changes |
| .size-limit.cjs | Removes the node-platform tanstackNode helper and
replaces two separate client/server size entries with a single
tanstack('gt-tanstack-start', 'index') entry at the same 52 kB limit |
| .changeset/tanstack-start-shared-barrel.md | Patch changeset
documenting the entrypoint consolidation for gt-tanstack-start |
</details>
<details><summary><h3>Flowchart</h3></summary>
<a href="#gh-light-mode-only">
```mermaid
%%{init: {'theme': 'neutral'}}%%
flowchart TD
subgraph Before
A1["gt-tanstack-start\n(browser condition)"] --> B1["index.client.mjs\n('use client')"]
A2["gt-tanstack-start\n(react-server condition)"] --> B2["index.server.mjs"]
A3["gt-tanstack-start\n(default condition)"] --> B3["index.server.mjs"]
B1 --> C1["gt-react (browser)\nindex.client.mjs"]
B2 --> C2["gt-react (react-server)\nindex.rsc.mjs"]
B3 --> C3["gt-react (default)\nindex.server.mjs"]
end
subgraph After
D1["gt-tanstack-start\n(any condition)"] --> E1["index.mjs\n(no 'use client')"]
E1 --> F1["gt-react resolves via\nits own conditions"]
F1 --> G1["browser → index.client.mjs\n('use client')"]
F1 --> G2["react-server → index.rsc.mjs"]
F1 --> G3["default → index.server.mjs\n('use client')"]
end
```
</a>
<a href="#gh-dark-mode-only">
```mermaid
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
subgraph Before
A1["gt-tanstack-start\n(browser condition)"] --> B1["index.client.mjs\n('use client')"]
A2["gt-tanstack-start\n(react-server condition)"] --> B2["index.server.mjs"]
A3["gt-tanstack-start\n(default condition)"] --> B3["index.server.mjs"]
B1 --> C1["gt-react (browser)\nindex.client.mjs"]
B2 --> C2["gt-react (react-server)\nindex.rsc.mjs"]
B3 --> C3["gt-react (default)\nindex.server.mjs"]
end
subgraph After
D1["gt-tanstack-start\n(any condition)"] --> E1["index.mjs\n(no 'use client')"]
E1 --> F1["gt-react resolves via\nits own conditions"]
F1 --> G1["browser → index.client.mjs\n('use client')"]
F1 --> G2["react-server → index.rsc.mjs"]
F1 --> G3["default → index.server.mjs\n('use client')"]
end
```
</a>
</details>
<sub>Reviews (3): Last reviewed commit: ["fix: remove tanstack start
types
subpath"](8ccbd3c)
| [Re-trigger
Greptile](https://app.greptile.com/api/retrigger?id=40968210)</sub>
<!-- /greptile_comment -->
## Summary
- merge `main` into `odysseus` and adapt the locale validation feature
to the current `I18nConfig` singleton flow
- fall back to the default locale with a warning when `gt-next` receives
an invalid request locale
- expose `isLocaleSupported()` from the root `gt-next` entrypoint
variants instead of `gt-next/server`
## Tests
- `pnpm exec oxfmt --check packages/cli/CHANGELOG.md
packages/cli/src/api/__tests__/downloadFileBatch.test.ts
packages/cli/src/api/downloadFileBatch.ts
packages/cli/src/formats/files/__tests__/fileMapping.test.ts
packages/cli/src/formats/files/fileMapping.ts
packages/gtx-cli/CHANGELOG.md packages/locadex/CHANGELOG.md
packages/next/src/condition-store/AsyncConditionStore.ts
packages/next/src/errors/createErrors.ts
packages/next/src/index.client.ts packages/next/src/index.rsc.ts
packages/next/src/index.server.ts packages/next/src/index.types.ts
packages/next/src/request/__tests__/localeValidation.test.ts
packages/next/src/request/localeValidation.ts
packages/next/src/request/registerLocale.ts`
- `pnpm exec oxlint
packages/cli/src/api/__tests__/downloadFileBatch.test.ts
packages/cli/src/api/downloadFileBatch.ts
packages/cli/src/formats/files/__tests__/fileMapping.test.ts
packages/cli/src/formats/files/fileMapping.ts
packages/next/src/condition-store/AsyncConditionStore.ts
packages/next/src/errors/createErrors.ts
packages/next/src/index.client.ts packages/next/src/index.rsc.ts
packages/next/src/index.server.ts packages/next/src/index.types.ts
packages/next/src/request/__tests__/localeValidation.test.ts
packages/next/src/request/localeValidation.ts
packages/next/src/request/registerLocale.ts`
- `pnpm --dir packages/next exec vitest run
src/request/__tests__/localeValidation.test.ts
src/__tests__/packageExports.test.ts`
- `pnpm --filter gt-next typecheck`
- `pnpm --dir packages/cli exec vitest run
src/api/__tests__/downloadFileBatch.test.ts
src/formats/files/__tests__/fileMapping.test.ts
--config=./vitest.config.ts`
- `pnpm --dir packages/core exec vitest run
src/translate/utils/__tests__/apiRequest.test.ts
--config=./vitest.config.ts`
- `pnpm --filter gt-next test:js`
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR merges the locale-validation feature from `main` into the
`odysseus` branch, adapting it to the `I18nConfig` singleton API, and
also fixes a long-standing lockfile bug where absolute output paths were
persisted instead of relative ones.
- **Locale validation**: Introduces `resolveLocaleOrDefault` and
`isLocaleSupported` in a new `localeValidation.ts` module; invalid or
unsupported request locales now fall back to the default locale with a
`console.warn` diagnostic instead of silently using whatever was passed.
- **API surface**: `isLocaleSupported` is promoted from `gt-next/server`
to all three root entrypoint variants (`index.client.ts`,
`index.rsc.ts`, `index.server.ts`) with a matching stub in
`index.types.ts`.
- **Lockfile path fix**: `downloadFileBatch` and `fileMapping` now store
`getRelative(outputPath)` rather than the absolute path, fixing
cross-machine portability of `gt-lock.json`.
<details open><summary><h3>Confidence Score: 5/5</h3></summary>
Safe to merge — all changed paths have direct test coverage and no
regressions were identified.
The locale-validation logic is straightforward, well-tested (happy path,
fallback, case-normalisation, `registerLocale` integration), and the
`resolveLocaleOrDefault` fallback is always safe (it always returns a
string). The lockfile path fix is a contained one-liner with a
confirming test. No pre-existing behaviours are removed, only guarded.
No files require special attention.
</details>
<details><summary><h3>Important Files Changed</h3></summary>
| Filename | Overview |
|----------|----------|
| packages/next/src/request/localeValidation.ts | New file implementing
locale validation with `resolveLocaleOrDefault` (falls back with a
warning) and `isLocaleSupported` (boolean predicate). Logic is correct
and tested. |
| packages/next/src/condition-store/AsyncConditionStore.ts | Threads
`resolveLocaleOrDefault` through `getLocale()` for the non-registered
path; replaces deprecated `getGTClass().determineLocale()` with
`determineSupportedLocale()`. Changes are correct. |
| packages/next/src/request/registerLocale.ts | Simplified to delegate
validation to `resolveLocaleOrDefault`, removing the direct dependency
on `getGTClass`. Behaviour is correct and tested. |
| packages/next/src/request/__tests__/localeValidation.test.ts |
Comprehensive new test suite covering happy paths, fallback behaviour,
case-normalisation, and `registerLocale` integration. |
| packages/next/src/index.client.ts | Adds `isLocaleSupported` export.
Mirrors identical changes in `index.rsc.ts` and `index.server.ts`. |
| packages/next/src/index.types.ts | Adds placeholder
`isLocaleSupported` declaration that throws the standard types-file
error, consistent with all other stubs in this file. |
| packages/cli/src/api/downloadFileBatch.ts | Single-line fix: stores
`getRelative(outputPath)` instead of the absolute `outputPath` in the
lockfile, fixing cross-machine portability. |
| packages/cli/src/formats/files/fileMapping.ts | Applies the same
relative-path fix for GTJSON template file mappings, consistent with the
`downloadFileBatch` change. |
| packages/next/src/errors/createErrors.ts | Adds
`createInvalidRequestLocaleWarning` diagnostic factory, cleanly
following the existing error-creation pattern. |
</details>
<details><summary><h3>Flowchart</h3></summary>
<a href="#gh-light-mode-only">
```mermaid
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["Incoming locale\n(request param / header / cookie)"] --> B{{"resolveLocaleOrDefault(locale)"}}
B --> C{"typeof locale === 'string'\n&& length > 0?"}
C -- No --> G["return resolveAliasLocale(defaultLocale)"]
C -- Yes --> D{{"i18nConfig.determineSupportedLocale(locale)"}}
D -- found --> E["return resolveAliasLocale(supportedLocale)"]
D -- undefined --> F["console.warn(createInvalidRequestLocaleWarning)"]
F --> G
subgraph Callers
R["registerLocale(locale)"] --> B
AC["AsyncConditionStore.getLocale()\n(no registered locale)"] --> B
end
subgraph isLocaleSupported
IS["isLocaleSupported(locale)"] --> DS{{"determineSupportedLocale(locale)"}}
DS -- found --> T["return true"]
DS -- undefined --> F2["return false"]
end
```
</a>
<a href="#gh-dark-mode-only">
```mermaid
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A["Incoming locale\n(request param / header / cookie)"] --> B{{"resolveLocaleOrDefault(locale)"}}
B --> C{"typeof locale === 'string'\n&& length > 0?"}
C -- No --> G["return resolveAliasLocale(defaultLocale)"]
C -- Yes --> D{{"i18nConfig.determineSupportedLocale(locale)"}}
D -- found --> E["return resolveAliasLocale(supportedLocale)"]
D -- undefined --> F["console.warn(createInvalidRequestLocaleWarning)"]
F --> G
subgraph Callers
R["registerLocale(locale)"] --> B
AC["AsyncConditionStore.getLocale()\n(no registered locale)"] --> B
end
subgraph isLocaleSupported
IS["isLocaleSupported(locale)"] --> DS{{"determineSupportedLocale(locale)"}}
DS -- found --> T["return true"]
DS -- undefined --> F2["return false"]
end
```
</a>
</details>
<sub>Reviews (2): Last reviewed commit: ["fix: return boolean from
locale support
..."](963f2f9)
| [Re-trigger
Greptile](https://app.greptile.com/api/retrigger?id=41163876)</sub>
<!-- /greptile_comment -->
---------
Co-authored-by: Ben Gubler <me@bengubler.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: fernando-aviles <fernando@generaltranslation.com>
Co-authored-by: Brian Lou <69982825+brian-lou@users.noreply.github.com>
## Summary
- extract duplicated useSyncExternalStore subscription filtering for
tracked translation and dictionary lookups
- leave missing-translation queue behavior unchanged
## Verification
- pnpm --filter @generaltranslation/react-core typecheck
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR extracts the duplicated `useSyncExternalStore` subscription
logic across three tracked-lookup resolver hooks into a single shared
hook, `useSubscribeToTrackedLookups`. The three callers now pass their
store subscribe method and key function as arguments instead of each
embedding identical inline helpers.
- **New shared hook** (`useSubscribeToTrackedLookups.ts`): generic over
the lookup type `L`, accepts the subscribe method and key extractor as
parameters, and owns the `versionRef` / `subscribe` / `getSnapshot`
wiring that was previously copy-pasted in each file.
- **Three callers updated** (`useTrackedTranslationResolver`,
`useTrackedDictionaryResolver`, `useTrackedDictionaryObjResolver`):
their local `useSubscribeToLookups` functions are deleted and replaced
with a call to the shared hook; imports are trimmed accordingly.
<details open><summary><h3>Confidence Score: 5/5</h3></summary>
Pure deduplication refactor — no behavioral change, only the shared
subscription logic is extracted into a single hook.
The store subscribe methods are arrow function class fields, making them
stable references per store instance. getDictionaryListenerKey and
getTranslateListenerKey are module-level functions and also stable. The
versionRef is scoped inside the shared hook so each call site gets its
own counter, preserving independent invalidation. No logic was altered —
only location and structure changed.
No files require special attention. The new
useSubscribeToTrackedLookups.ts is the only net-new code and it is a
straightforward extraction.
</details>
<details><summary><h3>Important Files Changed</h3></summary>
| Filename | Overview |
|----------|----------|
|
packages/react-core/src/hooks/external-store/useSubscribeToTrackedLookups.ts
| New shared hook extracting the tracked-lookup subscription pattern;
generic, correctly wired with stable deps, and own versionRef per call
site. |
|
packages/react-core/src/hooks/external-store/useTrackedTranslationResolver.ts
| Local useSubscribeToLookups helper removed; now delegates to the
shared hook with i18nStore.subscribeToTranslationEvents (stable
arrow-field) and module-level getTranslateListenerKey. |
|
packages/react-core/src/hooks/external-store/useTrackedDictionaryResolver.ts
| Duplicate useSubscribeToLookups removed; delegates to shared hook with
subscribeToDictionaryEntryEvents and getDictionaryListenerKey. |
|
packages/react-core/src/hooks/external-store/useTrackedDictionaryObjResolver.ts
| Duplicate useSubscribeToLookups removed; delegates to shared hook with
subscribeToDictionaryObjectEvents and getDictionaryListenerKey. |
</details>
<details><summary><h3>Sequence Diagram</h3></summary>
<a href="#gh-light-mode-only">
```mermaid
%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Caller as Resolver Hook
participant Shared as useSubscribeToTrackedLookups
participant Store as I18nStore
participant React as useSyncExternalStore
Caller->>Caller: init trackedKeysRef (Set)
Caller->>Shared: (trackedKeysRef, subscribeToEvents, getListenerKey)
Shared->>Shared: create versionRef
Shared->>React: useSyncExternalStore(subscribe, getSnapshot)
React->>Store: subscribe(listener)
Store-->>React: Unsubscribe fn
note over Store,Shared: On store event
Store->>Shared: onEvent(lookup)
Shared->>Shared: getListenerKey(lookup) in trackedKeysRef?
alt key tracked
Shared->>Shared: versionRef++
Shared->>React: listener() re-render
else key not tracked
Shared-->>Store: skip
end
```
</a>
<a href="#gh-dark-mode-only">
```mermaid
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Caller as Resolver Hook
participant Shared as useSubscribeToTrackedLookups
participant Store as I18nStore
participant React as useSyncExternalStore
Caller->>Caller: init trackedKeysRef (Set)
Caller->>Shared: (trackedKeysRef, subscribeToEvents, getListenerKey)
Shared->>Shared: create versionRef
Shared->>React: useSyncExternalStore(subscribe, getSnapshot)
React->>Store: subscribe(listener)
Store-->>React: Unsubscribe fn
note over Store,Shared: On store event
Store->>Shared: onEvent(lookup)
Shared->>Shared: getListenerKey(lookup) in trackedKeysRef?
alt key tracked
Shared->>Shared: versionRef++
Shared->>React: listener() re-render
else key not tracked
Shared-->>Store: skip
end
```
</a>
</details>
<sub>Reviews (1): Last reviewed commit: ["refactor: share tracked lookup
subscript..."](69f8f08)
| [Re-trigger
Greptile](https://app.greptile.com/api/retrigger?id=41016405)</sub>
<!-- /greptile_comment -->
## Summary
- Update the global singleton warning to state that the singleton was
already initialized.
- Update singleton warning tests to match the preserved-instance
behavior.
## Tests
- pnpm build
- pnpm --filter gt-i18n test
- pnpm --filter @generaltranslation/react-core test
- pnpm format
- pnpm lint
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR fixes a misleading warning message in the global singleton
factory: the old message said "Overwriting global X singleton instance"
but the code actually **preserves** the existing instance and returns
early without overwriting. The new message "Global X singleton instance
was already initialized" accurately reflects the preserved-instance
behavior.
- `createGlobalSingleton.ts`: Changes the `whatHappened` string in the
`set` guard from "Overwriting…" to "was already initialized" to match
the actual no-op behavior when a duplicate `set` is detected.
- Five test files updated to assert the corrected warning text across
`i18nConfig`, `i18nCache`, `i18nStore`, `conditionStore`, and the base
singleton factory.
<details open><summary><h3>Confidence Score: 5/5</h3></summary>
Safe to merge — the change is a single-line warning message correction
with no behavioral impact; all affected tests were updated consistently.
The only production code change is the warning string in
`createGlobalSingleton.ts`; the singleton's preserved-instance logic
(`return` without overwriting) is unchanged. All five downstream test
files were updated in lockstep to match the new message, and the tests
continue to assert that the original value is retained after a duplicate
`set`.
No files require special attention. The one minor follow-up is the stale
"overwrite warning" phrasing left in the JSDoc comment of
`createGlobalSingleton.ts`.
</details>
<details><summary><h3>Important Files Changed</h3></summary>
| Filename | Overview |
|----------|----------|
| packages/i18n/src/globals/createGlobalSingleton.ts | Warning message
corrected from "Overwriting" to "was already initialized" to accurately
reflect the preserved-instance behavior; a minor JSDoc comment still
uses the old "overwrite warning" phrasing. |
| packages/i18n/src/globals/__tests__/createGlobalSingleton.test.ts |
Test assertion updated to match the new warning text; also verifies the
original value is preserved after a duplicate set. |
| packages/i18n/src/i18n-config/__tests__/singleton-operations.test.ts |
Warning assertion updated to match new message text; no other logic
changes. |
| packages/i18n/src/i18n-cache/__tests__/singleton-operations.test.ts |
Warning assertion updated to match new message text; no other logic
changes. |
|
packages/i18n/src/condition-store/__tests__/createConditionStoreSingleton.test.ts
| Warning assertion updated to match new message text; no other logic
changes. |
|
packages/react-core/src/i18n-store/__tests__/singleton-operations.test.ts
| Warning assertion updated to match new message text; no other logic
changes. |
</details>
<details><summary><h3>Flowchart</h3></summary>
<a href="#gh-light-mode-only">
```mermaid
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["singleton.set(next)"] --> B{Is slot already\noccupied AND\nnext !== existing?}
B -- Yes --> C["console.warn\n'Global X singleton instance\nwas already initialized'"]
C --> D["return — existing\ninstance preserved"]
B -- No --> E["ns[key] = next\nsingleton stored"]
```
</a>
<a href="#gh-dark-mode-only">
```mermaid
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A["singleton.set(next)"] --> B{Is slot already\noccupied AND\nnext !== existing?}
B -- Yes --> C["console.warn\n'Global X singleton instance\nwas already initialized'"]
C --> D["return — existing\ninstance preserved"]
B -- No --> E["ns[key] = next\nsingleton stored"]
```
</a>
</details>
<sub>Reviews (2): Last reviewed commit: ["fix: correct global singleton
warning"](0464de0)
| [Re-trigger
Greptile](https://app.greptile.com/api/retrigger?id=41183771)</sub>
<!-- /greptile_comment -->
## Summary - Initialize gt-next server entrypoints through a shared server initializer. - Move request locale registration into `AsyncConditionStore` so `/server` and package root entrypoints use the same global condition-store singleton instead of separate module-level async stores. - Keep request locale validation from latest `odysseus` while routing registered locales through the shared condition store. - Add explicit module isolation in the entrypoint test so server import side effects do not depend on Vitest module cache order. ## Testing - `pnpm --filter gt-next exec vitest run src/__tests__/rscComponentWrappers.test.tsx src/request/__tests__/localeValidation.test.ts` - `pnpm --filter gt-next build` - `pnpm --filter gt-next test:js` - `pnpm lint` - `pnpm build:next-pages-router` in `~/Documents/dev/gt-testing-apps-wt/e-odysseus-server-entrypoint-initializer` ## Notes - Merged latest `origin/odysseus`. - Added a patch changeset for `gt-next`.
| * render never trigger network work synchronously. | ||
| */ | ||
| export function queueRuntimeTranslation( | ||
| lookup: TranslateLookup, | ||
| onSettled: () => void | ||
| ): void { | ||
| const key = getTranslateListenerKey( | ||
| lookup as Parameters<typeof getTranslateListenerKey>[0] | ||
| ); | ||
| let promise = inFlightTranslations.get(key); | ||
| if (!promise) { | ||
| promise = Promise.resolve() | ||
| .then(() => | ||
| getI18nCache().lookupTranslationWithFallback( | ||
| lookup.locale, | ||
| lookup.message as Translation, | ||
| lookup.options as Parameters< | ||
| ReturnType<typeof getI18nCache>['lookupTranslationWithFallback'] | ||
| >[2] | ||
| ) | ||
| ) | ||
| .then( | ||
| () => undefined, | ||
| () => undefined | ||
| ); | ||
| inFlightTranslations.set(key, promise); | ||
| } | ||
| promise.then(onSettled); |
There was a problem hiding this comment.
Resolved-promise accumulation causes infinite re-render loop on translation failure
When a runtime translation fetch fails (network error, rate limit, etc.), lookupTranslationWithFallback throws and the cache is not updated. The inFlightTranslations map keeps the now-resolved promise forever. On the next render, queueRuntimeTranslation finds the resolved promise and calls promise.then(onSettled), which schedules onSettled as an immediate microtask (since the promise is already settled). onSettled increments devHotReloadTick.value, Vue schedules a re-render, and the cycle repeats indefinitely — freezing the browser tab in dev mode whenever a translation fails to load.
The same issue applies to inFlightDictionaryEntries in queueRuntimeDictionaryTranslation. Cleaning up the entry after the promise settles would break the loop by allowing a fresh request on the next render instead of immediately scheduling another tick increment.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/vue/src/internal/runtimeTranslation.ts
Line: 23-50
Comment:
**Resolved-promise accumulation causes infinite re-render loop on translation failure**
When a runtime translation fetch fails (network error, rate limit, etc.), `lookupTranslationWithFallback` throws and the cache is not updated. The `inFlightTranslations` map keeps the now-resolved promise forever. On the next render, `queueRuntimeTranslation` finds the resolved promise and calls `promise.then(onSettled)`, which schedules `onSettled` as an immediate microtask (since the promise is already settled). `onSettled` increments `devHotReloadTick.value`, Vue schedules a re-render, and the cycle repeats indefinitely — freezing the browser tab in dev mode whenever a translation fails to load.
The same issue applies to `inFlightDictionaryEntries` in `queueRuntimeDictionaryTranslation`. Cleaning up the entry after the promise settles would break the loop by allowing a fresh request on the next render instead of immediately scheduling another tick increment.
How can I resolve this? If you propose a fix, please make it concise.| const rawCookieValue = document.cookie | ||
| .split('; ') | ||
| .find((row) => row.startsWith(`${cookieName}=`)) | ||
| ?.split('=')[1]; |
There was a problem hiding this comment.
Cookie value is truncated when it contains
= characters. split('=')[1] only returns the segment between the first and second =, so a base64-encoded or percent-encoded value with a trailing = would be silently shortened. Locale codes don't currently have =, but this is a latent correctness issue. Use slice(1).join('=') to capture everything after the first =.
| const rawCookieValue = document.cookie | |
| .split('; ') | |
| .find((row) => row.startsWith(`${cookieName}=`)) | |
| ?.split('=')[1]; | |
| const match = document.cookie | |
| .split('; ') | |
| .find((row) => row.startsWith(`${cookieName}=`)); | |
| const rawCookieValue = match ? match.split('=').slice(1).join('=') : undefined; |
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/vue/src/condition-store/cookies.ts
Line: 12-15
Comment:
Cookie value is truncated when it contains `=` characters. `split('=')[1]` only returns the segment between the first and second `=`, so a base64-encoded or percent-encoded value with a trailing `=` would be silently shortened. Locale codes don't currently have `=`, but this is a latent correctness issue. Use `slice(1).join('=')` to capture everything after the first `=`.
```suggestion
const match = document.cookie
.split('; ')
.find((row) => row.startsWith(`${cookieName}=`));
const rawCookieValue = match ? match.split('=').slice(1).join('=') : undefined;
```
How can I resolve this? If you propose a fix, please make it concise.| value: string; | ||
| }): void { | ||
| if (typeof document === 'undefined') return; | ||
| document.cookie = `${cookieName}=${value};path=/`; |
There was a problem hiding this comment.
Cookies are set without a
SameSite attribute. Modern browsers default to SameSite=Lax when the attribute is absent, but some older browsers (Safari < 12) treat it as SameSite=None, which makes these cookies available in cross-site requests. Explicitly declaring SameSite=Lax makes the intent clear and is consistent with how other GT libraries set locale cookies.
| document.cookie = `${cookieName}=${value};path=/`; | |
| document.cookie = `${cookieName}=${value};path=/;SameSite=Lax`; |
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/vue/src/condition-store/cookies.ts
Line: 32
Comment:
Cookies are set without a `SameSite` attribute. Modern browsers default to `SameSite=Lax` when the attribute is absent, but some older browsers (Safari < 12) treat it as `SameSite=None`, which makes these cookies available in cross-site requests. Explicitly declaring `SameSite=Lax` makes the intent clear and is consistent with how other GT libraries set locale cookies.
```suggestion
document.cookie = `${cookieName}=${value};path=/;SameSite=Lax`;
```
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
1da125d to
13dd724
Compare
Vue 3 binding for General Translation, built on the gt-i18n runtime (I18nConfig/I18nCache singletons + condition store): - createGT() plugin with a vue-router-style ready promise - reactive ref-backed condition store: setting the locale loads translations then flips the app in place (no page reload) - <T> component with VNode -> GT JSX serialization and translated-tree reconciliation (matching the shared GT JSX wire format) - Var, Num, Currency, DateTime, RelativeTime variable components - Branch and Plural branching components using named slots - useGT/useMessages/useTranslations, writable useLocale() ref (v-model compatible), LocaleSelector component, sync t() - dev hot reload: cache misses trigger runtime translation and a global reactive tick re-renders content when translations land
13dd724 to
06aff4d
Compare
Summary
New
gt-vuepackage (packages/vue): the Vue 3 binding of the GT libraries, built directly ongt-i18n's primitives (I18nConfig/I18nCachesingletons, condition store) and speaking the same GT JSX wire format asgt-react— with a Vue-native architecture modeled on vue-i18n / vue-router / pinia conventions rather than the React shape.Setup —
createGT()plugin with arouter.isReady()-style promise. One await at bootstrap; every lookup afterwards is synchronous:Reactive locale, no page reload. The condition store is backed by Vue refs;
setLocaleloads the new locale's translations, then flips the ref — the whole app re-renders in place (component state survives the switch).useLocale()returns a writable computed, so a custom locale selector is justv-model:Surface
<T>with<Var>/<Num>/<Currency>/<DateTime>/<RelativeTime>, and<Branch>/<Plural>(branches as named slots)useGT(),useMessages(),useTranslations(),msg(), synct()(tagged-template capable)useLocale()(writable ref),useLocales(),useDefaultLocale(),useLocaleProperties(),useLocaleDirection(),<LocaleSelector>createGT()— no provider component, no separate init functionImplementation notes
defineComponent/h(), no SFC build step), marked with_gttlike gt-react<T>tags slot VNodes with sequential GT ids into a parallel wrapper tree (no VNode cloning), serializes to GT JSX, hashes viahashMessage, reconciles translated trees against source VNodes by id<T>/useGT()/t()/ dictionaries when translations landTesting
hashMessagehashes, and reactive locale switching (locale.value = 'fr'→ translations flip, no reload)base/vite-vueapp in gt-test-apps (branche/odysseus/gt-vue), linked to this worktree:<T>/useGT()/t()/<Plural>starting from empty local files, locale switching en→fr→zh via<LocaleSelector>with a window-marker proof that no reload occurs, cookie +<html lang>syncvite build+preview) — 15/15 checks: fr/zh render instantly from bundled translation files, translated plural branches flip with the counter (whose state survives the locale switch)a0382323b1806463from vite-react'sfr.jsonresolves identically in the Vue app)Notes
0.0.0with amajorchangeset, sochangeset versionproduces1.0.0-odysseus.0, adds gt-vue topre.jsoninitialVersions, and generates its CHANGELOG (verified with a localchangeset versiondry run);changeset publishwill then ship it to theodysseusdist-tag. Versions independently (not in the react fixed group),minimumReleaseAgeExcludeupdated.workflowscope) — a maintainer should add--filter=gt-vueto thesizejob's build step in.github/workflows/ci.ymland avueentry to.size-limit.cjsin a follow-upgt-nuxt), CLI extraction for.vuefiles, and a Vue compiler plugin are follow-ups; dev hot reload + local/CDN files cover the current flow