fix(i18n): close the last three zh-branch gaps (#2871, part 3) - #2898
Merged
Conversation
The three items the classification marked as real but not a migrate-the-copy
fix. Each needed a different remedy.
LoadingScreen collapsed ten languages into two. It already selected real locale
packs rather than inline copy, but via `startsWith('zh') ? zh : en`, so a
ja/ko/de user watched the entire boot in English. Now indexes builtInLocales by
two-letter prefix, with a PER-FIELD fallback to `en` — `console.*` is one of the
namespaces trailing in the non-zh packs (#2872 part a), so a whole-object swap
would have rendered `undefined` on the splash instead of English.
`console.loadingHint` was in fact missing from all eight; added, because a blank
line under the progress list is worse than an English one.
containers.tsx had two language sources that could disagree: the call sites
resolved `language` from useObjectTranslation, then translateLabel called
detectLocale() and read document.documentElement.lang itself. Those update
independently, so an in-app language switch could leave a tab label and its
chrome in different languages until reload. `language` is threaded in and
detectLocale is deleted so nothing reaches for the DOM again.
field-types.ts carried a `labelZh` column beside `label`, capping the field-type
picker at two languages by construction. The 46 type names and 9 category names
move to the Studio catalog as `engine.fieldType.<id>` /
`engine.fieldCategory.<cat>`, generated from the existing values so no wording
changes. This removes `isZh` from BOTH ObjectFieldInspector and
ObjectFormCanvas — the two files classified as "keep the component, fix the
catalog".
Also caught while there: the picker's search filter matched id, the English
label, and `labelZh`, so searching in Japanese or German matched nothing. It now
matches the label as the user actually sees it.
Full suite 7730 passed. ESLint errors identical to baseline (25, all
pre-existing). turbo type-check 31/31 for the changed packages.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TubWYdWquVkS9dj733sDmC
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
os-zhuang
marked this pull request as ready for review
July 28, 2026 04:05
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 3 of #2871, after #2887 and #2893. These are the three items the classification marked as real but not a migrate-the-copy fix — each needed a different remedy, which is why they were held back from the earlier parts.
1.
LoadingScreen— ten languages collapsed to twoThe boot splash already selected real locale packs (not inline copy), so it wasn't in the
pick()cluster. But it chose vialang.startsWith('zh') ? zh : en, so a ja/ko/de user watched the entire startup in English.Now indexes
builtInLocalesby two-letter prefix — but with a per-field fallback toen, which is the part that matters:console.*is one of the namespaces trailing in the non-zhpacks (#2872 part a), so a whole-object swap would have renderedundefinedon the splash rather than English. I checked every key this component reads across all ten packs before writing it, andconsole.loadingHintwas in fact missing from all eight — added here, because a blank line under the progress list is worse than an English one.The
useObjectTranslationban stays: this renders before i18next initialises, and on a server-down boot i18n can't load at all.2.
containers.tsx— two language sources that could disagreeThe tab-label call sites resolved
languagefromuseObjectTranslation(), then passed the string totranslateLabel, which calleddetectLocale()and readdocument.documentElement.langitself. Those two update independently, so an in-app language switch could leave a tab label and the chrome around it in different languages until the next reload.languageis now threaded in, anddetectLocaleis deleted so nothing in this file reaches for the DOM again.KNOWN_LABEL_DICTand the'与'CJK separator stay — per the classification, normalising author-supplied schema data is legitimate and is not UI copy.3.
field-types.ts— a two-language data catalogFieldTypeMetacarried alabelZhcolumn besidelabel, which capped the field-type picker at English-or-Chinese by construction. The 46 type names and 9 category names move into the Studio catalog asengine.fieldType.<id>/engine.fieldCategory.<cat>.I generated those 110 entries from the existing values rather than retyping them, so no wording drifts in this change.
This is what removes
isZhfrom bothObjectFieldInspectorandObjectFormCanvas— the two files the classification listed as "keep the component, fix the catalog".labelZh,CATEGORY_LABEL_ZH, and the unknown-type fallback's Chinese'未知'are all gone with it.Caught while in there: the picker's search filter matched
id, the English label, andlabelZh— so typing a Japanese or German field-type name matched nothing. It now matches the label as the user actually sees it.Verification
Full suite 7730 passed, 1 skipped, 0 failed. ESLint errors identical to baseline (25, all pre-existing).
turbo type-check31/31 on the changed packages.One thing worth flagging from the type-check: my first version annotated
getStartupStrings(): typeof enLocale.console, which failed becauseen's literal-typed consts don't accept another pack's widenedstrings. Dropping the annotation and letting TS infer is correct — the consumers only read strings.Where #2871 stands after this
All 7 genuine bugs are fixed across parts 1–3. What remains under that issue is only the deliberate keeps:
conversationLanguage(detects the chat's language for the agent), the Studio catalog itself (1375 keys, ~1255 call sites — a multi-week refactor with no user-visible gain), andKNOWN_LABEL_DICT. I'd suggest closing #2871 once this lands.🤖 Generated with Claude Code
https://claude.ai/code/session_01TubWYdWquVkS9dj733sDmC
Generated by Claude Code