Repository navigation
fix(i18n): the Console language menu offers the platform locale table's languages - #31793
Conversation
…'s languages The menu reads the app's locale list through the table's read aliases and offers table tags only: a stored spelling (zh-CN) is its table entry with the table label, two spellings of one language are one entry, and a code the table does not name is not offered. The provisional self-heal adjudicates against the offered set; the checkmark and the profile page's stored value compare through the same resolution. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jRuaxwwjABz1AXpCeM
… offered tag in the column-apply pin Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jRuaxwwjABz1AXpCeM
…NG banner in its changeset Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jRuaxwwjABz1AXpCeM
|
domain:ui#3 · zhuangjianguo · session_01QsR2jVEjiYrK7onirxUGyo Contract-review-claim: session_01QsR2jVEjiYrK7onirxUGyo · head 96d210d · 2026-11-09T04:13Z |
|
domain:ui#3 · zhuangjianguo · session_01QsR2jVEjiYrK7onirxUGyo Run at Contract reviewServed-tier: Inputs read: card #30514 body and all 5 comments (6730644685, 6731352580, 6731426750, 6731445607, 6731472201); PR #31793 body, file list (8 paths) and ① Derived judgmentsEvery accept-set and public-surface change the diff implies, judged against the tree:
② Semver level
③ Boundary flags
④ Design judgmentThe narrowing itself, read against the published spec on Does it take a declared capability away at the consumer? The capability the menu loses is "offer whatever Tried to break it:
Findings:
No must-fix, no should-fix. Nits alone end the round. Implemented-by: VERDICT: PASS |
|
domain:ui#3 · zhuangjianguo · session_01QsR2jVEjiYrK7onirxUGyo 席位核对 · ACCEPT · 2026-11-09T04:46Z · head
|
Requested by Steedos · project thread
Fixes #30514
Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none — the published
objectstack-i18nskill never says the Console menu offers a locale outside the platform table, and everysupportedLocalesexample in it is a table language维护者速读
zh-CN这类旧写法显示成表里的名字(简体中文),同一语言只出现一次,th这类表外语言不再出现。th。th的用户会先以th启动,应用列表到达后自动回到默认语言。回滚只需 revert 本 PR,无数据迁移。ui/packages/i18n/src/provider.tsx(offeredTableTags与自愈判断),ui/packages/app-shell/src/layout/LocaleSwitcher.tsx(勾选),ui/apps/console/src/pages/system/ProfilePage.tsx(存储值读法)。cd ui && pnpm exec vitest run packages/app-shell/src/layout/__tests__/LocaleSwitcher.appLocales.test.tsx,预期全部通过,其中 app-crm、app-todo、HotCRM 三种声明都显示表内名称。What changes
offerableLanguages(the list the globe menu and the profile page's language card render) is now the platform locale table ∩ the app's locale list:GET /api/v1/i18n/locales) is read throughresolveBuiltInLanguage, which applies the table's read aliases and then shorter prefixes, the same resolution that picks the pack the code renders in;loadLocaleswiring, offers the table's 11 tags. An out-of-table key ofconfig.resourcesno longer adds an entry to that fallback.Around it:
provisionalself-heal (a stored language accepted on the loader's credit) is judged against the offered set, not the raw app list. A storedthstill boots, then reverts and is cleared once the list lands, even when the app liststh. The loader's credit andBootstrapLocaleOptions.hasLoaderare unchanged (seat amendment 2, option C).LocaleSwitchercompares the session language throughresolveBuiltInLanguage, so a session inzh-CNticks 简体中文.ProfilePagereads a storedsys_user.localespelling as its table tag (zh-CN→zh-Hans). Without that, the exact-match check prepended a stray 中文(中国) option beside 简体中文. A tag the table does not name stays as stored.What the menu offered before, measured
Probe on
origin/mainc2bb879: the realI18nProviderwith a mockedloadLocales. Step-1 report: #30514 comment 6731426750.loadLocales()answeren, zh-Hansen, zh-CNen, zh-CN, ja-JPen, zh-CN, ja-JP, es-ESen, zh-CN, then, zh-CN, zh-Hansde-AT, pt-PT, zh-TW, en-GBpt-BR)de,pt-BR,zh-Hant,enwith table labelsNarrowing census: 0 first-party apps affected
supportedLocalesdeclarations: examples/app-crm['en', 'zh-CN'], examples/app-showcase['en', 'zh-CN'], examples/app-todo['en', 'zh-CN', 'ja-JP'], HotCRMsrc/sales/index.ts['en', 'zh-CN', 'ja-JP', 'es-ES']. objectstack-ai/gallery declares none.config.resourcestoI18nProvider(git grepoverui/apps,ui/packages,ui/examples).Downstream readers of the offered tag
A pick now writes the table tag (
zh-Hans).zh-Hanswas already an offered value before this PR, in cases 1, 2a and 5. Each reader accepts it, measured:document.documentElement.lang = lng, and the end-to-end pin's DOM showslang="zh-Hans".createAuthenticatedFetchcopies the html lang attribute intoAccept-Language. Both i18n providers resolve a request locale withresolveLocaleAmong, andresolveLocaleAmong('zh-Hans', [en, zh-CN, ja-JP, es-ES, …])=zh-CN,ja→ja-JP,es→es-ES.sys_user.locale. The column'slocale_bcp47_shaperule (SYS_USER_LOCALE_TAG_PATTERN) acceptszh-Hans,zh-Hantandpt-BR. The messaging reader uses the same shape, and its bundle ladder is the sameresolveLocaleAmong.Why
Ruling F (#29428, of #29349): the platform supports one list of languages, each complete on every surface, with no tiers. Phases 2 and 3 completed the Console packs and the server bundles for the table's 11 languages. This phase makes the menu offer exactly those languages.
Tests
On
ui/as ofbbc447f4, fromui/, underscripts/pm/os-verify-lock.sh:packages/i18n/src/__tests__/,packages/app-shell/src/layout/__tests__/LocaleSwitcher*,apps/console/src/pages/system/__tests__/ProfilePage*: Test Files 107/107, Tests 1873 passed, 13 skipped.app-shell/src/hooks/__tests__/userLocale*,AppHeader*,studio-locale.i18n, consolei18nAfterSignIn-12034,loadLocales*,FirstRunChecklist,HomeLayout.searchOpensPalette-12601,sharedInboxFeed.twoSurfaces, plugin-formaffordanceGrantMap-12082): 46 files. 45 were green;userLocale-10059went red as expected and is the edited pin below, and that file now passes 24/24.New and rewritten pins:
LocaleSwitcher.appLocales.test.tsxthis not offered, whether it comes from the app list or fromconfig.resources;zh-CNbesidezh-Hansis one entry;zh-CNticks 简体中文.provider-app-locale-restore.test.tsxthboots, then reverts and is purged once the list lands;zh-CNstays and is offered aszh-Hans;ProfilePage.language.test.tsx(new top-level describe)zh-CNis one option with nothing to save;this still shown.Edited pin, approved by the seat:
userLocale-10059.test.tsx"renders the offered variant for a bare column, end to end". Azhcolumn withloadLocales['en','zh-CN']now showszh-Hans(before:zh-CN). The offered entry is now the table tag; the pack is the same.Ablation of the canonicalizing step (
offeredTableTagspushes the raw code instead of its table tag), throughscripts/ablation-replace.mjs:c7299ca5→2551b42e;provider-app-locale-restoreandLocaleSwitcher.appLocales(Tests 11 failed, 22 passed);git diff HEADempty.Acceptance notes
Ruling F gaps outside this card, carried on Platform locale table (ruling F of #29349): one list of 11 languages in spec, complete on every surface #29428 by the seat:
zh-Hantresolves to the Simplified catalogue;TranslationConfigSchemaaccepts an out-of-tablesupportedLocalesentry.This PR adds no language anywhere. It only removes entries.
localeLabel'sIntl.DisplayNamesbranch is now reached only for a code outside the table, which the menu no longer offers. It is left in place: it is exported and still named by its own tests.Verification
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 36 commands. All 36 were run and exited 0, and--ranreconciles 36 derived / 36 run / 0 NOT-MEASURED. The PR-body gates (check-changeset-no-major,check-adr-0087-registration,check-closing-keyword-parity,check-partof-closing-keyword) ran against this body and exited 0.pnpm --filter @object-ui/i18n run type-checkexited 0. The app-shell and console type-checks are left to CI's Type Check UI (they need the wholeui/closure built).96d210d4mergesorigin/main. The incoming commits touch no file in this diff, andui/is unchanged sincebbc447f4, where the suites above ran.(narrowing)arm. It is running on96d210d4, and its reading goes in the os-dev-report on i18n phase 4 (locale menu): the Console language menu offers the PLATFORM_LOCALES languages, intersected with an app’s supportedLocales #30514.Human Minimum
packages/specholds no runtime logic. (packages/specuntouched)pnpm lintpasses. (eslintover the seven touchedui/files: 0 errors; the repo-wide run is CI's)main, one pull request.packages/spectouched: n/a.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code