Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

fix(i18n): a region-tagged code loads its base built-in catalogue (objectui#11326) - #11367

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/issue-11326-i18n-region-locale-fallback
Oct 1, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/issue-11326-i18n-region-locale-fallback

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #11326
Clause-②: yes

What this changes

@object-ui/i18n keys its built-in catalogues by base language (zh). The platform, the Console's language menu and the stored choice all use full BCP-47 tags (zh-CN). isBuiltInLanguage and loadBuiltInLocale looked a code up exactly, so a stored zh-CN never fetched the zh catalogue, and every built-in string rendered through the en fallback on each full page load.

  • One normaliser, in the registry. matchLanguageTag(tag, has) in packages/i18n/src/locales/registry.ts is now the only exact-then-base implementation in the package. resolveBuiltInLanguage(lang) applies it to the catalogue keys.
  • Its readers. isBuiltInLanguage and loadBuiltInLocale read it, which are the ruling's two. isBuiltInLocaleLoaded reads it too; see deviation 1.
  • Memoisation key. A catalogue is fetched and memoised under its own code. zh and zh-CN share one fetch, and getLoadedBuiltInLocales() stays keyed by catalogue code, which is how createI18n and the app-shell splash read it.
  • resolveSeedLanguage reuses it. Its inline split is replaced by one matchLanguageTag(seed, ...) call whose predicate asks canResolveLanguage(code, config). canResolveLanguage stays the seed's only verdict, as its docblock requires.
  • The three provider.tsx call sites are untouched. These are preloadBootstrapLocale, the mount effect and changeLanguage, and each call-site line is present once at base and once at head. The provider.tsx diff has three hunks: the matchLanguageTag import, point 1 of resolveSeedLanguage's docblock (which said region subtags are "normalised away" and would now be false), and that function's body. Occurrences of the base-language split: provider.tsx 2 → 0, registry.ts 0 → 1. No fallback is copied into a call site; the one copy that existed moved into the registry.

Unchanged:

  • A code with no catalogue for the tag or for its base (xx-YY, tlh) is refused exactly as before.
  • No import() specifier moved. Shipped source has 0 changed import lines; the only import-adjacent change is one added named binding from the already-imported ./locales/registry.js.

Measured hypotheses

  • H1, reproduce first: confirmed. The provider pin and the registry rows were written before the fix and run against unmodified main sources: 7 failed, 3 passed. Every failure is the stated mechanism: loadBuiltInLocale('zh-CN') gives expected null not to be null, the provider renders expected 'Save' to be '保存', and the preload leaves zh not resident. The 3 passing rows are the controls: en resolves, xx-YY and tlh are refused, and a stored en renders English.
  • H2, exact-then-base order. LAZY_LOCALE_LOADERS holds zh ja ko de fr es pt ru ar, with en resident. No key is a full tag, so the exact-wins half is pinned on the normaliser itself (pt-BR wins over pt, pt-PT falls to pt) and on every real catalogue code resolving to itself, which a future zh-TW would inherit.
  • H3, the user's tag is kept: holds, pinned. After a boot with a stored zh-CN, and after changeLanguage('zh-CN'), the provider's language, the document's lang attribute and the stored value are all zh-CN, and the strings come from zh.
  • H4, unsupported codes: holds, pinned. isBuiltInLanguage('xx-YY') and isBuiltInLanguage('tlh') are false, and the loader gives null for both.

Why the provider pin takes a fresh module graph. The DOM projects make all ten catalogues resident (vitest.setup.i18n-catalogues.ts). With zh resident, i18next answers a zh-CN lookup out of the zh bundle through its own language hierarchy, so a pin in that state passes on the broken code. vi.resetModules() gives back the state a page load has: en resident and nothing else.

Deviations, stated rather than silent

  1. isBuiltInLocaleLoaded is a third reader. It is the same file and the same rule. Left exact, it would answer false for zh-CN while loadBuiltInLocale('zh-CN') resolves with no fetch, which contradicts its own docblock ("no fetch needed"). Zero callers in this repository. That makes three exported functions that now accept a region-tagged code, not two.
  2. The seed tier now boots in zh-CN, not zh. Seven assertions in six rows of provider-tenant-locale-seed.test.tsx move from zh to zh-CN, and in one row from ja to ja-JP. Each row still asserts what it was written for; the row about the pack the tag reaches now also asserts 保存. This is the direct consequence of the ruling: once isBuiltInLanguage('zh-CN') is true, canResolveLanguage accepts the exact tag. Keeping zh would need a second, exact-only "do we have this locale" predicate, which resolveSeedLanguage's docblock forbids. It is raised as an open question to the seat, with the alternative.
  3. The pending .changeset/7479-lazy-locale-catalogues.md gets a dated, append-only correction. Its "null for a code this package does not ship" is now false for zh-CN. The base blob is a byte-identical prefix of the head blob (cmp exit 0, 4501 base bytes, 571 appended), and the frontmatter md5 is identical.

Tests, at c2f59cf4a

  • pnpm exec vitest run packages/i18n/ plus 14 consumer files that boot, seed, store or switch to a region-tagged locale (in apps/console, examples/console-starter, app-shell, auth, components and plugin-charts). Result: 89 files passed, 1317 passed, 13 skipped.

  • Reverse verification on the committed state. registry.ts and provider.tsx were checked out from base under an EXIT/INT/TERM trap with absolute paths. On disk, matchLanguageTag went 3 → 0 and the registry blob equals the base blob. The final pin file then ran 10 failed, 3 passed:

    • the 7 H1 rows failed as above;
    • the memoise row failed with expected the catalogue to be null, because at base zh-CN gives null while zh gives the catalogue;
    • the two normaliser rows failed with TypeError ... is not a function, because the export does not exist at base;
    • the 3 controls stayed green.

    The restore came from HEAD. Both hashes equal the HEAD blobs and git diff HEAD is empty. The pin imports ../provider.js and ../locales/registry.js relatively, so the subject resolves to src/; no dist is on the path and no rebuild was needed.

Gates, at c2f59cf4a

  • ① pnpm --filter '@object-ui/i18n^...' build (types, core): exit 0.
  • ② @object-ui/i18n: build (with dist completeness) exit 0; type-check (script echoed, tsc --noEmit && tsc -p tsconfig.test.json) exit 0; lint exit 0. Nothing in eslint.config.js is type-aware, and CI's pnpm lint runs each package's eslint ., so this is CI's lint verdict for every touched TypeScript file.
  • ③ Exit 0: check:control-bytes, check:new-line-citations (with --base set to the branch point), check:changeset-claims, check:pending-changeset-literals, check-changeset-presence, check-changeset-no-major, check:doc-fences, check:i18n-keys, check:test-path-roots, check:unreferenced-sources. check-governed-queue-guard --test: NOT GOVERNED.
  • NOT MEASURED: check:readme-exports. Its population collapsed because 33 of 40 packages are unbuilt in this worktree, which is a could-not-run and not a verdict. No finding in that run names packages/i18n/README.md. Left to CI.
  • NOT MEASURED: check:doc-snippets. The full gate needs 34 package closures built, which is CI's run. A narrowed measurement was taken instead: the one edited README block compiles --strict against the built @object-ui/i18n dist (exit 0), and a negative control with isBuiltInLanguage(42) fails with TS2345 (exit 2).
  • NOT MEASURED: check:eager-locale-catalogues and check:eager-closure. Both need a full console production build. Shipped source changes no import() specifier and the LAZY_LOCALE_LOADERS block is unchanged; the source-shape pin entry-locale-shape-7479.test.ts passed in the run above.

Docs

  • The packages/i18n/README.md built-in locales block states the lookup rule and the zh-CN example, and the persistence paragraph says a stored zh-CN is kept as written.
  • content/docs/guide/troubleshooting.md §8 step 3 notes that built-in catalogues are looked up exact tag first, then base language.
  • .changeset/11326-i18n-region-locale-fallback.md: @object-ui/i18n minor, with the widening stated.

Acceptance notes

These are observations only; none was filed. Each was read from source, not measured through a public entry point.

  • Duplicate bundle at mount. For a stored region tag, the provider's mount effect checks getResourceBundle(currentLang) by the exact tag. It therefore adds a zh-CN bundle that duplicates the resident zh one, which costs one extra re-render of every reader at mount. Avoiding it needs a change at that call site, which the ruling excluded. Carrier: none.
  • Tags differ by boot tier. Browser detection (pickInitialLanguage) still strips to the base (ja-JP → ja), while the stored and seed tiers now keep the full tag. Carrier: none.
  • isRTL matches exactly. isRTL checks RTL_LANGUAGES exactly, so ar-EG reads as left-to-right. This is the same family. No producer of an ar-* tag was found; the showcase offers en and zh-CN. Carrier: none.
  • A second exact-then-base copy. @object-ui/app-shell's pickRenderableLocale keeps its own copy of the order. matchLanguageTag is deliberately not on the package entry; the ruling kept it registry-internal. Carrier: none.
  • The switcher's checkmark. LocaleSwitcher marks the active entry by exact language === code. A host without loadLocales offers bare codes, so a stored zh-CN shows no checkmark there. The Console wires loadLocales and offers zh-CN. Carrier: none.
  • zh-TW gets Simplified. A region tag with no full-tag catalogue gets its base: zh-TW reads the Simplified zh catalogue. That is i18next's own hierarchy and the order the seed already used.
  • Wildcard subpath. matchLanguageTag and resolveBuiltInLanguage are reachable through the ./locales/* wildcard subpath (@object-ui/i18n/locales/registry), as registerBuiltInLocale already is. They are not on the package entry.

Same-family cards whose content is out of scope: objectui#10862, objectui#10969 and objectui#10748 are about missing catalogue rows. They remain open, and nothing here touches them.


Generated by Claude Code

…jectui#11326)

The built-in catalogues are keyed by base language (`zh`) while the platform,
the Console's language menu and the stored choice speak full BCP-47 tags
(`zh-CN`). `isBuiltInLanguage` and `loadBuiltInLocale` looked a code up
exactly, so a stored `zh-CN` never fetched the `zh` catalogue and every
built-in string rendered through the `en` fallback on each page load.

One exact-then-base normaliser, `matchLanguageTag`, now lives in the registry.
`isBuiltInLanguage`, `isBuiltInLocaleLoaded` and `loadBuiltInLocale` read it
through `resolveBuiltInLanguage`; a catalogue is fetched and memoised under its
own code, so `zh` and `zh-CN` share one fetch. `resolveSeedLanguage` reuses the
same function instead of its inline copy. The three provider call sites are
untouched.

Claude-Session: https://claude.ai/code/session_01VhxTqosz7wn54ahqyxgERT
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added documentation Improvements or additions to documentation tests package: i18n labels Oct 1, 2026
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

changeset-claim-re-read

⚠️ 2 pending changeset(s) describe a file this change touches

Their bodies publish verbatim into the CHANGELOG at the next release, so this is a request to re-read them against your diff — addressed here because you are the one seat that can answer it without re-deriving anything.

⛔ Nothing here blocks, and nothing here is a verdict on your change. This gate exits 0, is not a required context, and judges name resolution, never meaning: it asked whether a pending body names a file you touched. "Is this sentence still true?" is the one question it will not answer, and the one you are being asked to answer.

.changeset/8632-malformed-picklist-option-loud.md

  • names packages/i18n/README.md → packages/i18n/README.md — edited by this change

    Two new strings land in the designer's own en / zh tables — the metadata-admin console owns its strings in views/metadata-admin/i18n.ts and is deliberately outside the ten locale packs (packages/i18n/README.md, "Scope — the engine.* carve-out").

.changeset/9615-locale-count-ten.md

  • names packages/i18n/README.md → packages/i18n/README.md — edited by this change

    Correcting the numeral to ten was weighed and refused. A restated count is the construct that permitted the error, and this repository has now watched it recur three times over the same fact — objectui#3351 in a changeset file, objectui#7989 in packages/i18n/README.md, and this one in published source. So the number is gone rather than corrected: the sentence now claims only what it needs (the key is translated in every locale the package ships) and names all-locales-key-parity.test.ts as the instrument that re-derives it. That test asserts the stronger invariant — every pack defines every en key — over whatever the pack set is on the day it runs, so an eleventh pack makes the sentence more true rather than false, and there is no figure left to rot (AGENTS.md commandment 完善设计器的每一个细节 #9).

Read the paragraph, not the line: both false halves of the objectui#8617 claim sat in one paragraph, and correcting either alone would have left it asserting the same wrong thing.

If a claim did go false, correct the body. That is precedented and prose-only, frontmatter untouched; check-changeset-overwrite.mjs will report the correction as its own case 2 ("correcting a declaration on purpose … legitimate"), which is the intended shape — one gate asks for the read, the other records the write.

Not covered, stated so nobody reads this as more: a born-false claim that spells no line address at all (objectui#9495 coordinated one by ORDINAL — "a grep finds that member first" — and deciding that means reading what the sentence means), a claim spelled as a symbol or a package rather than a backticked file name, and a file named ambiguously.

Compared the checked-out tree with 5638529e6 (merge-base with origin/main): 6 file(s) changed outside .changeset/, read against 1913 pending declaration(s) that publish a body (2528 pending in total). · run

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

Metric Value Budget
Eager closure (gzip, 330 chunks) 3552.8 KB 3574.6 KB
Main entry chunk (gzip) 150.4 KB 350 KB
Entry file index-D23FsH5L.js —
Status PASS —

The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it.


📦 Bundle Size Report

Package Size Gzipped
app-shell (consoleActionDispatch.js) 0.20KB 0.19KB
app-shell (index.js) 16.88KB 6.25KB
app-shell (runtime-config.js) 20.68KB 7.36KB
app-shell (types.js) 0.01KB 0.04KB
app-shell (urlParams.js) 10.11KB 3.87KB
auth (ActiveOrganizationStorage.js) 27.95KB 10.04KB
auth (AuthContext.js) 0.31KB 0.24KB
auth (AuthGuard.js) 2.07KB 1.00KB
auth (AuthProvider.js) 40.22KB 10.61KB
auth (AuthShell.js) 3.49KB 1.40KB
auth (ForgotPasswordForm.js) 12.21KB 3.45KB
auth (LoginForm.js) 18.17KB 5.40KB
auth (PreviewBanner.js) 0.90KB 0.50KB
auth (RegisterForm.js) 6.72KB 2.24KB
auth (SocialSignInButtons.js) 9.70KB 3.93KB
auth (UserMenu.js) 3.39KB 1.21KB
auth (auth-gate-events.js) 1.29KB 0.66KB
auth (authStyles.js) 5.04KB 1.72KB
auth (createAuthClient.js) 40.70KB 10.94KB
auth (createAuthenticatedFetch.js) 8.54KB 3.46KB
auth (index.js) 3.63KB 1.64KB
auth (invitation-status.js) 1.22KB 0.70KB
auth (org-roles.js) 6.66KB 2.78KB
auth (phone-identifier.js) 1.11KB 0.66KB
auth (types.js) 0.59KB 0.35KB
auth (useAuth.js) 5.30KB 1.02KB
auth (useWorkspaceAdminStatus.js) 11.08KB 4.58KB
collaboration (CommentThread.js) 27.13KB 7.95KB
collaboration (LiveCursors.js) 3.17KB 1.27KB
collaboration (PresenceAvatars.js) 6.49KB 2.64KB
collaboration (PresenceProvider.js) 2.79KB 1.13KB
collaboration (index.js) 1.68KB 0.73KB
collaboration (useCollaborationTranslation.js) 6.05KB 2.52KB
collaboration (useCommentSearch.js) 1.98KB 0.88KB
collaboration (useConflictResolution.js) 7.75KB 1.86KB
collaboration (useMentionNotifications.js) 1.81KB 0.68KB
collaboration (usePresence.js) 6.33KB 1.84KB
collaboration (useRealtimeSubscription.js) 7.91KB 2.01KB
components (index.js) 571.28KB 136.83KB
core (index.js) 10.00KB 3.96KB
create-plugin (index.js) 27.94KB 9.51KB
data-objectstack (index.js) 229.96KB 63.80KB
fields (index.js) 261.05KB 66.23KB
i18n (LocalizationContext.js) 1.76KB 0.96KB
i18n (builtinAggregateLabels.js) 0.86KB 0.49KB
i18n (currency.js) 2.59KB 1.22KB
i18n (fallbackInterpolation.js) 6.25KB 2.77KB
i18n (i18n.js) 8.87KB 3.64KB
i18n (index.js) 5.24KB 2.27KB
i18n (pickLocalized.js) 9.86KB 3.95KB
i18n (provider.js) 39.35KB 12.88KB
i18n (translateFn.js) 0.20KB 0.18KB
i18n (useDisplayLocale.js) 3.52KB 1.76KB
i18n (useObjectLabel.js) 34.49KB 9.23KB
i18n (useSafeTranslation.js) 5.60KB 2.33KB
layout (index.js) 40.55KB 11.41KB
mobile (MobileProvider.js) 0.92KB 0.49KB
mobile (ResponsiveContainer.js) 0.94KB 0.38KB
mobile (breakpoints.js) 1.51KB 0.70KB
mobile (createOfflineDataSource.js) 5.61KB 1.75KB
mobile (index.js) 1.99KB 0.87KB
mobile (offlineQueue.js) 3.91KB 1.35KB
mobile (pwa.js) 0.97KB 0.49KB
mobile (serviceWorker.js) 1.48KB 0.62KB
mobile (serviceWorkerSource.js) 3.41KB 1.48KB
mobile (useBreakpoint.js) 1.54KB 0.65KB
mobile (useGesture.js) 6.96KB 1.98KB
mobile (useOfflineSync.js) 1.99KB 0.72KB
mobile (usePullToRefresh.js) 6.62KB 2.45KB
mobile (useResponsive.js) 0.72KB 0.42KB
mobile (useSpecGesture.js) 5.52KB 2.10KB
mobile (useTouchTarget.js) 1.01KB 0.54KB
permissions (MePermissionsProvider.js) 13.86KB 5.00KB
permissions (PermissionContext.js) 0.31KB 0.25KB
permissions (PermissionGuard.js) 0.89KB 0.45KB
permissions (PermissionProvider.js) 6.52KB 2.26KB
permissions (discardProofCache.js) 1.04KB 0.55KB
permissions (evaluator.js) 8.33KB 3.07KB
permissions (index.js) 0.93KB 0.41KB
permissions (store.js) 0.91KB 0.42KB
permissions (useFieldPermissions.js) 1.28KB 0.53KB
permissions (usePermissions.js) 4.83KB 2.27KB
plugin-ai (index.js) 16.01KB 3.93KB
plugin-calendar (index.js) 53.15KB 15.45KB
plugin-charts (index.js) 84.07KB 22.93KB
plugin-chatbot (index.js) 198.22KB 46.97KB
plugin-dashboard (index.js) 139.34KB 37.30KB
plugin-designer (index.js) 216.54KB 44.64KB
plugin-detail (index.js) 245.45KB 64.47KB
plugin-editor (index.js) 2.23KB 1.05KB
plugin-form (index.js) 173.25KB 44.58KB
plugin-gantt (index.js) 173.11KB 43.10KB
plugin-grid (index.js) 231.53KB 63.59KB
plugin-kanban (index.js) 49.49KB 15.54KB
plugin-list (index.js) 116.63KB 28.97KB
plugin-map (index.js) 23.54KB 7.83KB
plugin-markdown (index.js) 13.88KB 4.80KB
plugin-report (index.js) 44.04KB 12.21KB
plugin-timeline (index.js) 33.91KB 10.00KB
plugin-tree (index.js) 11.20KB 3.89KB
plugin-view (index.js) 90.32KB 22.76KB
providers (DataSourceProvider.js) 0.75KB 0.39KB
providers (MetadataProvider.js) 1.37KB 0.59KB
providers (ThemeProvider.js) 1.90KB 0.85KB
providers (UploadProvider.js) 11.81KB 3.58KB
providers (index.js) 0.45KB 0.23KB
providers (types.js) 0.01KB 0.04KB
react-runtime (index.js) 5.62KB 2.34KB
react (LazyPluginLoader.js) 4.47KB 1.63KB
react (SchemaRenderer.js) 119.55KB 39.23KB
react (data-invalidation.js) 5.05KB 2.08KB
react (index.js) 4.50KB 2.06KB
react (schema-input.js) 4.25KB 2.04KB
react (spec-input.js) 0.20KB 0.18KB
sdui-parser (body-dialect.js) 4.50KB 1.99KB
sdui-parser (codegen.js) 9.45KB 3.76KB
sdui-parser (dashboard-widget-options.js) 3.08KB 1.30KB
sdui-parser (index.js) 6.06KB 2.68KB
sdui-parser (input-type.js) 2.84KB 1.40KB
sdui-parser (parse.js) 25.28KB 7.80KB
sdui-parser (provenance.js) 3.84KB 1.90KB
sdui-parser (types.js) 0.28KB 0.23KB
sdui-parser (validate.js) 21.42KB 7.05KB
types (ai.js) 4.39KB 2.17KB
types (api-types.js) 0.20KB 0.18KB
types (app.js) 4.12KB 1.61KB
types (base.js) 0.20KB 0.18KB
types (blocks.js) 0.20KB 0.18KB
types (complex.js) 3.19KB 1.62KB
types (crud.js) 0.20KB 0.18KB
types (dashboard-filter-alias.js) 6.23KB 2.74KB
types (data-display.js) 3.75KB 1.85KB
types (data-protocol.js) 0.20KB 0.19KB
types (data.js) 0.20KB 0.18KB
types (designer.js) 1.85KB 0.85KB
types (disclosure.js) 0.20KB 0.18KB
types (error-code.js) 1.54KB 0.88KB
types (expression.js) 0.20KB 0.18KB
types (feedback.js) 0.20KB 0.18KB
types (field-types.js) 0.20KB 0.18KB
types (form.js) 0.20KB 0.18KB
types (http-inflight.js) 8.87KB 3.73KB
types (http-retry.js) 4.32KB 2.02KB
types (icon-key-migration.js) 4.26KB 1.63KB
types (index.js) 4.74KB 2.26KB
types (layout.js) 0.20KB 0.18KB
types (managed-by.js) 0.19KB 0.18KB
types (mobile.js) 5.00KB 2.39KB
types (navigation.js) 0.20KB 0.18KB
types (objectql.js) 0.20KB 0.18KB
types (overlay.js) 0.20KB 0.18KB
types (permissions.js) 2.52KB 1.31KB
types (plugin-scope.js) 0.20KB 0.18KB
types (record-components.js) 0.20KB 0.19KB
types (record-semantics.js) 1.28KB 0.67KB
types (registry.js) 0.20KB 0.18KB
types (reports.js) 0.20KB 0.18KB
types (select-option.js) 0.20KB 0.19KB
types (spec-report.js) 4.99KB 1.96KB
types (spec-ui-namespace.js) 0.20KB 0.19KB
types (strict-authoring-face.js) 21.59KB 7.71KB
types (system-fields.js) 3.33KB 1.54KB
types (theme.js) 6.28KB 2.87KB
types (ui-action.js) 8.11KB 3.32KB
types (views.js) 0.20KB 0.18KB
types (widget.js) 0.20KB 0.18KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: c2f59cf4adee420e043ea4d27923b7fd1a0f1317
Local-runs: none

Reviewed 2026-10-01T08:54Z from: card #11326 (body and all four comments), PR #11367 (body, file list, and the net diff against main — merge-base 2c274e3a8; main has since moved six commits to 5638529e6, none touching packages/i18n, the 7479 changeset or troubleshooting.md), and the check-runs on the head, read last. Not read: the dispatch order. Read as claims, not conclusions: os-dev-report 5927863627, ACCEPT 5927897751, the PR body. Governing texts: objectui AGENTS.md at origin/main, triage's direction 5925746061, and objectstack#5419's final ruling as claim 5255335825 quotes it.

① Derived judgments

The widening — three entry exports (packages/i18n/src/index.ts re-exports all three from ./locales/registry.js). New accept set for each: a tag whose exact form, or whose split('-')[0] base, is one of the ten catalogue codes; everything else refused.

  • isBuiltInLanguage — right. Docblock ("exactly, or through its base language") matches the body, resolveBuiltInLanguage(lang) !== null. xx-YY, tlh and en_US (underscore, so no split) stay false; pinned in region-locale-fallback-11326.test.tsx and the seed suite's "ignores a malformed tenant locale".
  • loadBuiltInLocale — right. Resolves the base catalogue and fetches/memoises under the CATALOGUE code (loaded[code], inFlight keyed by code), so getLoadedBuiltInLocales() stays keyed zh — which is how createI18n, app-shell's LoadingScreen (getLoadedBuiltInLocales()[base]) and outboundAgentText read it. Pinned ("memoises under the catalogue code — zh-CN and zh share one catalogue"). The docblock's null list drops "a region subtag" — correct.
  • isBuiltInLocaleLoaded — right as the third reader. Left exact it would answer false for zh-CN while loadBuiltInLocale('zh-CN') resolves with no fetch, contradicting its own "no fetch needed". Zero callers outside the registry at head (grep). Named in the PR ("three exported functions … not two") and in the changeset.
  • Exact over base: LAZY_LOCALE_LOADERS holds zh ja ko de fr es pt ru ar, en resident — no full-tag key exists, as the PR states. The order is pinned on the normaliser (pt-BR wins over pt, pt-PT falls to pt, xx-YY null) and on each of the ten resolving to itself. Right.
  • A narrowing the PR does not state, judged acceptable: a catalogue made resident through registerBuiltInLocale under a code OUTSIDE the ten was found by loadBuiltInLocale/isBuiltInLocaleLoaded at base and is not at head (hasBuiltInCatalogue consults DEFAULT_BUILT_IN_LANGUAGE and the loaders, not loaded). No producer exists: registerBuiltInLocales() registers exactly the ten, and registerBuiltInLocale is off the entry by its own docblock. Residual, not blocking.

The language preserved — judged from the pins. "keeps the user's tag" and "switching to zh-CN at runtime" assert language, the document lang attribute and localStorage['objectui-locale'] all zh-CN while common.save renders 保存. createI18n passes lng only (no supportedLngs, load or lowerCaseLng), so i18next keeps zh-CN as the language and reads the zh bundle through its own hierarchy. Right.

provider.tsx — three hunks, no call-site fallback. Verified by line at base 2c274e3a8 and at head: preloadBootstrapLocale's loadBuiltInLocale(resolveBootstrapLanguage(options)), the mount effect's isBuiltInLanguage(currentLang) guard and its loadBuiltInLocale(currentLang), and changeLanguage's loadBuiltInLocale(lang) each appear once at both refs. The inline seed.split('-')[0] is gone; resolveSeedLanguage is now one matchLanguageTag(seed, …) call whose predicate is canResolveLanguage(code, config) and nothing else. Docblock point 1 is rewritten because "normalised away" would now be false. Right, and it is the reuse triage's direction 5925746061 named.

Derived effects through canResolveLanguage (private), each a consequence of the widening:

  • A stored region tag survives the bootstrap purge on a host with no loadLanguage — at base canResolveLanguage('zh-CN', config, false) was false and clearStoredLanguage() ran; at head it is true. Pinned ("a host with no loader"); the changeset states it. Right.
  • On a host with a loader, that stored tag is now provisional: null (statically known), so the app-locale-list self-heal no longer adjudicates it. Right: the value is renderable from the built-in pack, which is what the purge rule protects.
  • offerableLanguages keeps a region-tagged app locale whose base is built-in even without loadLanguage. Unstated; right — canResolveLanguage is the one judge, by ruling.
  • pickInitialLanguage is unchanged in effect: it already strips the browser tag to its base before asking.
  • The seed tier boots in the stated tag (zh-CN, ja-JP) — judged in ③.

The seed rows. Seven assertions in six rows of provider-tenant-locale-seed.test.tsx move 'zh' to TENANT_LOCALE ('zh-CN') and one 'ja' to 'ja-JP'. Every row still asserts a specific language; rows 1 and 2 also assert 保存, and row 2 GAINED that string assertion. Updated, not weakened. (Rows 1 and 2 now pin the same pair — a redundancy, not a weakening.)

The mount effect's side-effect, stated by the PR: for a stored region tag it adds a zh-CN bundle beside the resident zh (one extra added re-render at mount). Functionally harmless; fixing it is a call-site change the direction excluded. Carried in the PR's notes; not blocking.

One over-broad sentence, not blocking: matchLanguageTag's docblock, resolveSeedLanguage's point 1 and the PR body call it "the ONE implementation of this order in the package". pickLocalized/setLocalized still resolve exact then base (then regional sibling …) over inline locale maps — four split('-')[0] sites at head — as the old provider docblock itself cited. They are value resolvers pinned limb-for-limb to a backend twin and rightly untouched; the sentence should say "for a tag to a catalogue or a seed", not "in the package". A wording follow-up.

② Semver level

  • .changeset/11326-i18n-region-locale-fallback.md — '@object-ui/i18n': minor. Right. The diff's only published source is packages/i18n/src/** (tests aside); the change is an additive accept-set widening of three entry exports; major is barred by the version-alignment rule (AGENTS.md 版本号策略, check-changeset-no-major). No other package's src or contract field moved, so one changeset is the right count. Every sentence checked against the head: the memoisation key, isBuiltInLocaleLoaded('zh-CN') answering for zh, xx-YY/tlh refused, "a catalogue keyed by a full tag would win — none ships today", the stored tag kept as written, the no-loader purge that no longer runs, preloadBootstrapLocale and changeLanguage fetching zh, the seed booting in zh-CN — all true. ("the tag the signed-in user's sys_user.locale applies a moment later" describes the Console's useSignedInUserLocale; the seed exists for that host, so it stands.)
  • .changeset/7479-lazy-locale-catalogues.md — the base blob (4,501 bytes, origin/main) is a byte-identical prefix of the head blob (5,072; cmp -n 4501 exit 0); frontmatter bytes identical; 9 lines appended, 0 removed. The note is dated, cites the card, and describes the base text accurately (the loadBuiltInLocale bullet's "null for a code this package does not ship"; isBuiltInLanguage(code) paired with the ten). Bump levels unchanged. Right.
  • Clause-②: yes — right: three published functions widen their accept set. The line itself is bare; the PR's "What this changes" names isBuiltInLanguage, loadBuiltInLocale and isBuiltInLocaleLoaded and deviation 1 says "three exported functions … not two"; the changeset names the same three. The claim's Why yes named two; the PR supersedes it with three, declared as a deviation.
  • Docs: packages/i18n/README.md's persistence paragraph and built-in-locales block state the rule and the zh-CN example (the snippet already imported isBuiltInLanguage; isBuiltInLocaleLoaded is prose and is exported). content/docs/guide/troubleshooting.md §8 step 3 is accurate and distinguishes built-in catalogues from the app's own locale files. The gates that judge all of this on the head — Changeset Bump Policy, Changeset Declaration, Changeset Claim Re-read, Changeset Fixed Group Check, README Export Check, Doc Snippet Type Check, Line Citation Gate — are each success.

③ Boundary flags

  • open_questions[0] — seed tier, A or B. Answered by the seat (ACCEPT 5927897751): B. Judged against the governing text, objectstack#5419's final ruling (2026-08-06T04:14Z) as claim 5255335825 quotes it: canResolveLanguage is the sole resolvability judge and the seed must reuse it — 「不得再造第二个"这个 locale 我们有没有"的判定」. Keeping zh would need exactly that second, exact-only predicate; B needs none and the resolveSeedLanguage docblock holds as written. The answer stands.
  • Deviation 1 — isBuiltInLocaleLoaded third reader. Accepted by the seat; judged right in ①; named in PR and changeset.
  • Deviation 2 — seed rows. Judged in ①: updated, not weakened.
  • Deviation 3 — 7479 note. Judged in ②: append-only, frontmatter intact.
  • Deviation 4 — README and troubleshooting. Judged in ②.
  • Out-of-scope findings, carrier none (five, in the PR's Acceptance notes). The duplicate zh-CN bundle at mount, the browser tier still base-stripped, pickRenderableLocale's own copy in app-shell, and LocaleSwitcher's exact checkmark are adequately carried as notes. One I escalate to the seat for a card rather than a note: isRTL matches exactly (RTL_LANGUAGES.includes(lang)), so an ar-XX tag that this change now boots AND renders in Arabic gets dir=ltr. Same family and no producer in the stock showcase, so not blocking here — but after this head "Arabic chrome, left-to-right" is reachable from a configured supportedLocales, which it was not before.
  • The wording residual ("the ONE implementation") — a follow-up edit, not a re-spin.
  • Check-runs on c2f59cf4a, read last — these are the gate verdicts. 43 runs: 40 success, 3 skipped (dependabot and the two coverage entries), 0 failed, 0 in_progress. At first read (2026-10-01T08:50Z) Test shards 1/8, 2/8 and 4/8 were still in_progress; polled, all three settled success by 2026-10-01T08:52Z. The families the dev left to CI as NOT MEASURED answer here: README Export Check success, Doc Snippet Type Check success, and the console production builds (Build & E2E, Bundle Analysis) success; Lint, Type Check, Test (dist pins) and all eight test shards success.

Implemented-by: claude/issue-11326-i18n-region-locale-fallback
Reviewed-by: session_01VhxTqosz7wn54ahqyxgERT

VERDICT: PASS

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review October 1, 2026 08:55
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge October 1, 2026 08:55
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Oct 1, 2026
Merged via the queue into main with commit d0fba91 Oct 1, 2026
45 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-11326-i18n-region-locale-fallback branch October 1, 2026 09:12
os-litant pushed a commit that referenced this pull request Oct 1, 2026
…jectui#11168 slice 3, round 4)

origin/main d0fba91 (#11346, #11359, #11361, #11367). It touches
pnpm-lock.yaml, which this branch also edits (the plugin-tree
devDependency link); no conflict.

Claude-Session: https://claude.ai/code/session_01VhxTqosz7wn54ahqyxgERT
Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

documentation Improvements or additions to documentation package: i18n tests

Projects

None yet

2 participants