Web: finish the #4934 dictionary spine — retire every isZh branch and inline { en, zh } module
Problem
#4934 established one dictionary path for every routed locale (chrome + home read getChrome(locale) / getHome(locale)), and the code comments in web/lib/i18n/config.ts mark the remaining page bodies as "awaiting the same move". On current main that remainder is still large:
- 40 files under
web/app/[locale]/,web/components/, andweb/lib/still branch onisZh(docs pages, community, contribute, constitution, faq, feed, digest, admin, shared components, …) - 2 inline
{ en, zh }content modules remain inweb/lib/content/(getting-started.ts,vocabulary.ts)
Consequences:
- Every partial locale (ja / vi / ko / ru / uk / es / pt-BR / id) is locked out of those page bodies — the dictionary layer routes them, but the copy is hardcoded into a two-language ternary, so there is nowhere to put a translation without editing TSX.
- en/zh copy edits happen in page markup rather than dictionaries, outside the
check:locales/dictionaries.test.tsgates — which is exactly how terminology drift like the 宪法/宪章 mismatch (#4949) survived.
Proposal
Migrate page-by-page to the dictionary architecture, as a series of small behavior-preserving PRs (one page group per PR):
- Phase 1 — shared surfaces:
docs/layout.tsxand shared components still branching onisZh - Phase 2 — docs pages: one PR per small group (
docs/guide,docs/fleet,docs/mcp, …), each adding the page's dictionary shape underweb/lib/i18n/dictionaries/<code>/for en + zh, with every other locale falling back to English exactly as today - Phase 3 — content modules + long-tail pages (
getting-started.ts,vocabulary.ts, community, contribute, faq, feed, digest, admin)
Per-PR gates: npm run check:locales, npm test, npm run lint; rendered en/zh output stays identical (pure move, no copy edits mixed in — any wording fix goes in its own commit/PR).
End state: zero isZh branches outside the i18n layer; partial locales gain page-body coverage by dictionary drop-in, matching how chrome/home already work; all site copy sits behind the parity gates.
Offer
I'm volunteering to run this as a tracked series — I'll keep a phase/page checklist in this issue, one PR per group, rebased onto main per the repo's cadence. Two questions before the first PR:
- Is this direction still wanted as scoped by #4934?
- Any pages you'd rather keep out of scope for now (e.g.
admin)?
Thanks @Lstarsky0 for the report.
This issue is staying open for maintainer triage. CodeWhale gets better because people bring us real edge cases from real machines, providers, regions, and workflows.
If you can add a reproduction, logs, version output, screenshots, or the provider/model involved, that makes it much easier for us to verify and harvest the fix. Maintainers may comment /lgtmi to mark recurring issue reporters as approved so this intake note is skipped next time.
Tracking
Phase 1 — infrastructure + first page
- [x]
OPTIONAL_FILESgate category +pickTextbridge + first page (docs/guide) — #5338 (draft pending the scoping answers above)
Phase 2 — docs pages (one PR per group, smallest first)
- [ ] docs/constitution
- [ ] docs/web
- [ ] docs/fleet
- [ ] docs/configuration · docs/hooks
- [ ] docs/tools · docs/troubleshooting
- [ ] docs/mcp · docs/modes · docs/sandbox · docs/subagents
- [ ] docs/vocabulary · docs/work · docs/runtime-api · docs/page (index) · docs/layout
Phase 3 — content modules + long-tail pages
- [ ]
lib/content/getting-started.ts·lib/content/vocabulary.ts(dissolve{ en, zh }pairs; retirepickText) - [ ] community · contribute · constitution (top-level) · faq
- [ ] feed · digest · components (
feed-cardKIND_LABEL,thinking-traceexcerpts) - [ ] admin (pending the scoping answer above)
Each PR: copy moved verbatim, check:locales + vitest + eslint green, en/zh render unchanged. Wording fixes (e.g. the 宪法→宪章 unification from #4949) land as separate copy-only commits once the structure is in.
great idea!! thank you so much!!
Phase 1 shell is up: #5488 moves docs/layout.tsx — the portal hero every docs page sits under — and docs/page.tsx's metadata onto DocsShellDict. Worth doing before the page bodies: that hero was English for every locale except zh, on every docs page, not just one.
Updated checklist:
Phase 1 — infrastructure + shared surfaces
- [x]
OPTIONAL_FILESgate category +pickTextbridge + first page (docs/guide) — #5338 - [x]
docs/layout.tsx+docs/page.tsx(hub metadata) — #5488 - [ ] the 9 shared components (
nav,docs-sidebar,docs-search,faq-search,status-badge,getting-started-steps,session-media,terminal-player,thinking-trace)
Phase 2 — docs pages (one PR per group, smallest first)
- [ ] docs/hooks · docs/troubleshooting
- [ ] docs/constitution · docs/runtime-api
- [ ] docs/sandbox · docs/web
- [ ] docs/modes · docs/configuration
- [ ] docs/subagents · docs/fleet
- [ ] docs/mcp · docs/work
- [ ] docs/vocabulary · docs/tools
Phase 3 — content modules + long-tail pages
- [ ]
lib/content/getting-started.ts·lib/content/vocabulary.ts(dissolve{ en, zh }pairs; retirepickText) - [ ] community · contribute · constitution (top-level) · faq
- [ ] feed · digest · install · roadmap · runtime · models
- [ ] admin (pending the scoping answer above)
- [ ] the
isZhusage example inpage-meta.ts's JSDoc, which currently teaches the pattern the series is retiring
Phase 2 is reordered by isZh count rather than by name, smallest first — on current main that runs from hooks and troubleshooting at 12 each up to tools at 22.
Recount on current main: 42 files match isZh, but 5 of those are not branches — three doc comments in the i18n layer, the JSDoc example in page-meta.ts, and the assertions in public-copy.test.ts that pin remaining ternaries. So 37 real ones: 16 under docs/, 12 other pages, 9 components.
One thing #5488 established that the rest of the series can reuse: these pages build to static HTML, so "rendered output unchanged" is measurable rather than asserted — build the branch and the base, strip scripts and tags, compare visible text and <title>/meta per locale, with a one-character control to prove the comparison bites. 36 pages came out byte-identical there. I'll run the same check on each group.
Phase 2 starts: #5504 moves docs/hooks and docs/troubleshooting, the two smallest at 12 isZh branches each. #5490 closed out the shared components, so Phase 1 is done.
One thing worth flagging for the rest of the series. Both pages here were whole-string ternaries except the hooks overview sentence, which typesets [[hooks.hooks]], /hooks and [hooks].enabled as inline <code>. Those spans are config syntax rather than copy, so they stay in the page and the sentence carries a {token} for each — splitTokens is the multi-token sibling of splitToken. Later groups have more of these, and this keeps the mixed-JSX paragraphs translatable without a translator ever editing a code span.
Updated checklist:
Phase 1 — infrastructure + shared surfaces
- [x]
OPTIONAL_FILESgate category +pickTextbridge + first page (docs/guide) — #5338 - [x]
docs/layout.tsx+docs/page.tsx(hub metadata) — #5488 - [x] the 9 shared components — #5490
Phase 2 — docs pages (one PR per group, smallest first)
- [x] docs/hooks · docs/troubleshooting — #5504
- [ ] docs/constitution · docs/runtime-api
- [ ] docs/sandbox · docs/web
- [ ] docs/modes · docs/configuration
- [ ] docs/subagents · docs/fleet
- [ ] docs/mcp · docs/work
- [ ] docs/vocabulary · docs/tools
Phase 3 — content modules + long-tail pages
- [ ]
lib/content/getting-started.ts·lib/content/vocabulary.ts(dissolve{ en, zh }pairs; retirepickText) - [ ] community · contribute · constitution (top-level) · faq
- [ ] feed · digest · install · roadmap · runtime · models
- [ ] admin (pending the scoping answer above)
- [ ] the
isZhusage example inpage-meta.ts's JSDoc, which currently teaches the pattern the series is retiring
Separately, #5503 fixes something the baseline measurement for this PR turned up: lib/deploy-preflight.test.ts spawns its script by URL.pathname, so a checkout under a non-ASCII path fails 7 cases that look like missing Cloudflare credentials. Unrelated to the series, but it was making my before/after test counts unreadable.
#5517 takes the next group: docs/constitution and docs/runtime-api, 14 isZh branches each.
Both needed the splitTokens pattern from #5504 — the constitution overview and the runtime-api security paragraph typeset paths and flags as inline <code>. What is new here is a second kind of code-owned literal: the seven command headings in the runtime-api entry list and the en/zh badge pair on each constitution principle row render identically in every locale, so the dictionaries key their rows and the literals stay in the page. docs/VOICE.md already asks for this, so later groups can follow the same rule rather than deciding case by case.
Worth knowing for whoever takes the next group: the 36-page rendered-output comparison caught a real difference this time. The old JSX wrapped lines mid-sentence in the zh constitution copy, and JSX folds those newlines into spaces, so the live page has a space after 主入口: that reads like a typo. The dictionary reproduces it, because a move that also fixes typography is no longer a move. Expect one or two of these per page and check for them before assuming a clean diff.
Phase 2 remaining after this: docs/sandbox · docs/web, docs/modes · docs/configuration, docs/tools · docs/mcp, docs/subagents · docs/fleet, docs/vocabulary · docs/work.