Repository navigation
fix(i18n): server t() fills {{ name }} holes written with spaces, as the Console does - #38265
Conversation
…the Console does FileI18nAdapter.t() and createMemoryI18n().t() now accept whitespace inside the braces, matching the Console's i18next; a hole with no value is written back exactly as authored. Claude-Session: https://claude.ai/code/session_01L9qibxWAZYhFuv668TruUa Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 2 package(s): 1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 41 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin eb3cbf3317960b1e91cc180aa82c454bb98aff12 && git checkout eb3cbf3317960b1e91cc180aa82c454bb98aff12
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 73ec085afa2f9689ef96263a9c25b82cde6fda47 f447517c5b7c8c8e229781c9a9a73498d02eccd1 && git checkout -B drift-repro 73ec085afa2f9689ef96263a9c25b82cde6fda47 && git merge --no-ff f447517c5b7c8c8e229781c9a9a73498d02eccd1
node scripts/docs-audit/affected-docs.mjs --json 73ec085afa2f9689ef96263a9c25b82cde6fda47
|
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 Contract reviewServed-tier: Why TIER_DEFAULT: the review is owed by the ① Derived judgments
② Semver levelRight. ③ Boundary flags
No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 L1-a ACCEPT at
|
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 Contract reviewServed-tier: A mechanical delta from record 7238665113 (TIER_DEFAULT PASS at ① Derived judgments
② Semver levelUnchanged and right: ③ Boundary flags
No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 L1-a delta: ACCEPT at
|
|
repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU Landing · 2026-11-28T12:17Z · zone
|
Requested by Tesla · project thread
Fixes #38092
repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU
Clause-②: yes (widening)
Metadata-protocol: semantic
Skills-docs: none — skills/objectstack-i18n already teaches the {{variable}} form; the spaced form is tolerated to match the Console, not a new form to teach
维护者速读
What changes
packages/services/service-i18n/src/file-i18n-adapter.ts:interpolatematches{{, optional whitespace, a word, optional whitespace,}}, so{{ name }}and tab-spaced holes are filled like{{name}}. A hole with no value is written back exactly as matched ({{ missing }}), where the old code re-spelled it as{{missing}}. Docblocks say so.packages/core/src/fallbacks/memory-i18n.ts: the in-memory fallbackt()gets the same pattern and the same write-back.{name}) are still not a placeholder on either side.@objectstack/core,@objectstack/service-i18nminor (Metadata-protocol: semantic: on the server a translation string's{{ name }}now means a placeholder instead of literal text).Not changed:
packages/spec(the validation / operation message override interpolator has the same gap; the seat files it as its own card), ui, locale packs, HotCRM, skills.Tests
packages/services/service-i18n/src/file-i18n-adapter.test.ts, a new top-leveldescribe: the same bundle string goes toFileI18nAdapter.t()andcreateMemoryI18n().t(), and each answer must equal what the Console's i18next answered for that template (measured, table below):{{name}},{{ name }}, a tab plus two spaces, single braces, and a spaced hole with no value.packages/core/src/fallbacks/fallbacks.test.ts: one test in core's own suite ({{ name }}filled, a spaced hole with no value kept as written), so core alone catches a regression.Per-form readings (params
{ name: 'Ada' }):FileI18nAdapter/createMemoryI18nHi {{name}}!Hi Ada!Hi Ada!Hi Ada!Hi {{ name }}!Hi Ada!Hi {{ name }}!Hi Ada!Hi Ada!Hi Ada!Hi {name}!Hi {name}!Hi {name}!Hi {name}!Hi {{ missing }}!Hi {{ missing }}!Hi {{ missing }}!Hi {{ missing }}!Acceptance notes
origin/mainbd5407ecbefore any edit: a probe fed one template to real i18next 26.4.0 (the Console's dependency, its default{{ }}interpolation),createMemoryI18n().t()andFileI18nAdapter.t(). Readings are the "Console" and "main" columns above.interpolateValidationMessageinpackages/spec/src/system/validation-message.tsfills translated validation and operation message overrides and still reads only{{label}}. The probe measured a{{ label }}override printed as written. The seat files it as a separate card.plugin-auditactivity-summary-message.ts,plugin-approvalsapproval-notification-text.ts, coresecurity/change-record-owner.ts. Their docblocks say they follow "the convention botht()use", which is now only true for unspaced holes. Left as is.Verification
pnpm --filter @objectstack/service-i18n exec vitest run src/file-i18n-adapter.test.tsshows 61 passed, 10 of them the new block.interpolateinfile-i18n-adapter.ts, then thet()return line inmemory-i18n.ts.Local readings at cc1fe06
pnpm --filter @objectstack/service-i18n test: Test Files 4 passed, Tests 87 passed;typecheckexit 0.pnpm --filter @objectstack/core typecheck && pnpm --filter @objectstack/core test: Test Files 158 passed, Tests 3807 passed.scripts/ablation-replace.mjs, each restore blob == HEAD andgit diff HEADempty:FileI18nAdapterspaced, tab).dist/: core suite 1 failed; adapter suite 2 failed (createMemoryI18nspaced, tab). After restore and a forced core rebuild,dist/index.jscarries the new pattern on the memory line.{{key}}: 1 failed (spaced hole with no value).dispatch-gates --ranwith recorded exit codes (gates-ran-cc1fe06c.list): 67 derived, 65 exit 0, 2 NOT MEASURED (exit 3:check-plugin-teardown-shape --self-test, fixture commit outside the shallow clone;check:dual-build-cjs-loads, needs a fullpnpm build), 0 unrun.check:lean-entry-closureexit 0 after an objectql build.overlap-check.mjsVERDICT clean exit 0 against origin/main 98bd8de.Generated by Claude Code