fix(i18n): delete the four pick({en,zh}) clones (#2871, part 2) - #2893
Merged
Conversation
Four files each carried an identical private resolver that read
`document.documentElement.lang` and branched on `startsWith('zh')`. Only
Chinese was ever handled, so the other eight shipped languages silently
rendered English — and because the copy lived in the components as inline
{en,zh} pairs, no translator could reach it. All four copies are deleted along
with their `I18n` type alias.
Migrated to the locale packs in all ten languages:
- `excelImport.*` (8) — ExcelImportBar
- `cloudOnboarding.*` (5) — CloudOnboardingNext (Cloud welcome page)
- `aiModelStatus.*` (11) — CloudAiModelStatus
- `chatbotQuota.*` (4) — the AI quota banner
Two spots needed restructuring rather than a straight port:
- The import toast was a template literal baked into both variants; it is now
a `{{count}}` / `{{object}}` interpolation.
- The AI-model error spliced a conditional `(HTTP nnn)` fragment mid-sentence,
which no translator can reorder. It is now two whole sentences.
The chatbot banner still chooses between the server's `quota.message` (zh) and
`quota.messageEn` — that pair is server-owned — but decides using the console's
active language rather than `navigator.language`, which had ignored the in-app
locale switcher entirely.
CloudOnboardingNext's tests now render inside a real I18nProvider. Without one
`t()` returns the raw key, so the previous assertions on literal English were
asserting nothing — they failed the moment the component resolved properly,
which is how I caught it. Same failure mode as EnvironmentListToolbar in part 1.
The `startsWith('zh')` sites that remain are the ones classification marked
KEEP: LoadingScreen (bootstrap, and it selects real locale packs),
conversationLanguage (detects the chat's language for the agent, not UI copy),
containers.tsx (normalises author-supplied schema data; `'与'` is a CJK
typography rule), and the Studio/field-types data catalogs.
Full suite 7664 passed. ESLint errors identical to baseline (25, all
pre-existing). type-check clean except the pre-existing maplibre-gl error in
plugin-map.
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 03:02
This was referenced Jul 28, 2026
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 2 of #2871, following #2887. This completes the
pick()cluster.The clones
Four files each carried a byte-identical private resolver:
Only Chinese was ever handled, so ja/ko/de/fr/es/pt/ru/ar silently rendered English — and because the copy sat in the components as inline
{en, zh}pairs, no translator could reach it without a code change. All four copies are gone, along with theirI18ntype alias.excelImport.*ExcelImportBarcloudOnboarding.*CloudOnboardingNext— the Cloud welcome pageaiModelStatus.*CloudAiModelStatuschatbotQuota.*ChatbotEnhancedAll added to all ten packs, so this doesn't widen the gap tracked by #2872 part (a).
Two spots needed restructuring, not a straight port
The import toast was a template literal baked into both variants:
Now a real
{{count}}/{{object}}interpolation, so a translator controls where the numbers land.The AI-model error spliced a conditional fragment mid-sentence:
Porting that shape would hand translators a sentence with a hole punched in a position their word order may not allow. It's now two complete sentences —
readFailedandreadFailedWithStatus.Also migrated:
sourceLabel(), the enum→prose helper (nowt-driven with a{{source}}placeholder), and the threeModelRowlabels, which were inline pairs I only caught when reading the call sites.The chatbot banner keeps its server-string choice
It still picks between the server's
quota.message(zh) andquota.messageEn— that pair is server-owned and can't move to the packs. But it now decides using the console's active language rather thannavigator.language, which had ignored the in-app locale switcher entirely: a user who switched the console to Chinese still got English here.Another test that was asserting nothing
CloudOnboardingNext's tests asserted literal English while rendering without anI18nProvider. They failed the moment the component started resolving properly — same failure mode asEnvironmentListToolbarin part 1, and the same fix: render inside a real provider pinned toen.Worth noting these two tests would have passed against any English string, including a wrong one.
What deliberately stays
The remaining
startsWith('zh')sites are the ones the #2871 classification marked KEEP, and I verified each is untouched:LoadingScreen— boot-critical chrome that must paint before i18next initialises; it already selects the real locale packs, not inline copyconversationLanguage— detects the chat's language for the agent, not UI copycontainers.tsx— normalises author-supplied schema data; its'与'separator is a genuine CJK typography rulefield-types.tsdata catalog — tracked separatelyVerification
Full suite 7664 passed, 1 skipped, 0 failed. ESLint errors identical to baseline (25, all pre-existing).
turbo type-checkclean except the pre-existingmaplibre-gldefault-export error inplugin-map. en↔zh parity holds.🤖 Generated with Claude Code
https://claude.ai/code/session_01TubWYdWquVkS9dj733sDmC
Generated by Claude Code