Skip to content

Commit b33365c

Browse files
docs(skills): objectstack-i18n teaches i18n.sourceLocale (#33934)
<!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9XvDBw73kUzCQbvPjg5vDdt)_ Fixes #33635 Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:`objectstack-i18n` 技能的 `i18n` 键表新增 `sourceLocale` 一行(内联 `label:` 文本的语言,缺省即 `defaultLocale`),并写明英文编写、中文用户的配法和 `fallbackLocale` 的服务端注意事项;`--default-locale` 的说明改为"覆盖源语言"。 - 为什么改:技能只教 `defaultLocale`,AI 给"英文写、卖给中国用户"的应用会写 `defaultLocale: 'en'`,丢掉用户默认语言,或得到大量误报的"缺 en"。 - 风险与回滚:纯文档 + 一条评测用例,不动运行时;回滚即 revert 本 PR。 - 先看:`skills/objectstack-i18n/SKILL.md` 键表下方新增的四行(服务端注意事项一句)、`skills/objectstack-i18n/evals/bundles-locales-coverage.json` 的第 11 条用例。 - 两分钟验证:`node scripts/check-skills-token-ratchet.mjs`,预期 i18n 行显示 `6146 / 6333` 且全绿。 - 需要你做的:批准本 PR。 ## What changes `skills/objectstack-i18n/SKILL.md` (published, English): - **Key table:** a `sourceLocale` row (optional, defaults to `defaultLocale`; the language inline `label:` text is written in; read by `os lint`, `os i18n check`, `os i18n extract`). The `defaultLocale` row now says what it is: the locale a user who has not chosen one gets. - **Under the table (4 lines):** an English-authored app for Chinese users declares `defaultLocale: 'zh-CN', sourceLocale: 'en'`, not an English `defaultLocale` (the warning does not spell the literal the eval refuses). The serving caveat as the spec change published it: label serving still reads inline text as `defaultLocale` text, so without `fallbackLocale: 'en'` an `en` request reaches the zh-CN bundle before the English inline label. The serving card (#33634) is still open, so the caveat names no future behaviour. One clause names the refused near-miss spellings `sourceLanguage` / `authoringLocale` / `authoringLanguage`. - **Translation Coverage:** "Gaps in the default locale are errors" now says source locale. That is the locale `computeI18nCoverage` raises errors against (`resolveSourceLocale`). - **Extract Skeletons:** the source locale (not "the default locale") is filled from schema labels. `--default-locale` overrides the source locale for one run (`i18n.sourceLocale`, else `i18n.defaultLocale`, else `en`). It moved out of the trailing flag list into that sentence, so the list no longer repeats it. Every taught fact is read from origin/main: `TranslationConfigSchema.sourceLocale` and its `aliases` in `packages/spec/src/system/translation.zod.ts`; `resolveSourceLocale` / `withGatedDefaultLocale` in `packages/cli/src/utils/i18n-coverage.ts`; the `--default-locale` help in `packages/cli/src/commands/{lint,i18n/check,i18n/extract}.ts`. `skills/objectstack-i18n/evals/bundles-locales-coverage.json`: case 11 (English-authored app, Chinese users by default). It must contain `sourceLocale`, `defaultLocale: 'zh-CN'`, `fallbackLocale: 'en'` and `supportedLocales`, and must not contain `defaultLocale: 'en'` or `sourceLocale: 'zh-CN'`, shapes only a wrong (English-default or role-swapped) config writes. It is self-consistent: no `must_not_contain` string occurs in its own `expected_output` or in the skill passages a correct answer quotes (the only SKILL.md hits are the two English-default config examples). Spliced with the file's hand formatting kept. `.changeset/33635-i18n-source-locale-skill.md`: `'@objectstack/skills': patch`. ### Size readings (tree: objectstack-ai/objectstack, origin/main 895783a → this head) | Reading | Before | After | |:--|--:|--:| | `skills/objectstack-i18n/SKILL.md` lines | 524 | 530 (net +6, at budget) | | `skills/objectstack-i18n/SKILL.md` bytes | 23901 | 24603 | | `skills/objectstack-i18n/SKILL.md` tokens (ratchet convention) | 5971 | 6146 (ceiling 6333, headroom 187) | | All 11 `skills/*/SKILL.md` lines | 4590 | 4596 | | All 11 `skills/*/SKILL.md` tokens | 59043 | 59218 (+175) | | `evals/bundles-locales-coverage.json` bytes | 8195 | 9353 (eval fixture, measured, not ratcheted) | The ratchet row is untouched: the file stays under its ceiling, so nothing is raised. No duplicate needed trimming to pay for it. ## Tests No code changed, so there is nothing to ablate. Gate readings are below under Verification. ## Acceptance notes - **Build tier, declared:** `dispatch-gates --tier` puts `skills/**` at the contract-review tier (clause ①, no one-line exit). This card thread is served at the default build tier and cannot switch its own model. With the seat's consent, the authoring (all three files and the commit) ran in an isolated os-dev subagent pinned to the contract-review tier inside this worktree. The relay writes, gates and report ran in the thread. - **Not taught, on purpose:** "`sourceLocale` need not appear in `supportedLocales`" and "with `sourceLocale` declared, `defaultLocale` is gated and scaffolded even when `supportedLocales` omits it". Both are true on main. They did not fit the +6-line budget, and `content/docs/ui/translations.mdx` carries both. - The config example at the top of the skill keeps `defaultLocale: 'en'`, which is correct for an English-default app. ## Verification All readings are at head `5b52d088` (review round 1; the derived list is unchanged from `d3909868`) (`git rev-parse --short HEAD` after the last commit), tree objectstack-ai/objectstack. - Package build closure: `turbo run build --concurrency=2 --filter='./packages/**'` under `os-verify-lock.sh`, `VERDICT command-exit 0` (held 9m38s). - Acceptance gates: `check:skill-docs` ✅ "Skill docs in sync"; `check:skill-refs` ✅ "9 generated files in sync with packages/spec"; `check:skill-examples` ✅ "346 prose examples type-check across 3 surface(s)"; `check-skills-token-ratchet` ✓ "57 authored bundle file(s) within their ceilings", i18n row `6146 / 6333`. - `dispatch-gates --ran`: "47 derived famil(ies) accounted for — 47 run, 0 NOT-MEASURED (a DERIVED zero)". Two extra runs are recorded outside the derivation (`check:skill-examples`, `check:skill-refs`). - CI families outside the derived list are left to this PR's check-runs. <details><summary>Derived gate list, 47 + 2, exit codes captured before any pipe</summary> ```text node scripts/check-adr-0087-registration.mjs --base origin/main :: exit 0 node scripts/check-adr-0087-registration.mjs --self-test :: exit 0 node scripts/check-changeset-no-major.mjs --base origin/main :: exit 0 node scripts/check-closing-keyword-parity.mjs :: exit 0 node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0 node scripts/check-comment-mask-corpus.mjs :: exit 0 node scripts/check-doc-route-spelling.mjs --advisory :: exit 0 node scripts/check-doc-route-spelling.mjs --self-test :: exit 0 node scripts/check-dts-emitted.mjs --self-test :: exit 0 node scripts/check-empty-changeset.mjs --base origin/main :: exit 0 node scripts/check-empty-changeset.mjs --self-test :: exit 0 node scripts/check-skills-token-ratchet.mjs :: exit 0 node scripts/check-skills-token-ratchet.mjs --self-test :: exit 0 node scripts/ci/assert-turbo-remote-cache.mjs --self-test :: exit 0 node scripts/ci/plan-test-core-shards.mjs --self-test :: exit 0 node scripts/ci/prune-turbo-cache.mjs --self-test :: exit 0 node scripts/ci/snapshot-next.mjs --self-test :: exit 0 node scripts/pm/check-governed-queue-guard.mjs --self-test :: exit 0 node scripts/pm/release-rehearsal-clone.mjs --self-test :: exit 0 node scripts/release-pending-publish.mjs --self-test :: exit 0 pnpm --filter @objectstack/lint run check:doc-formula-expressions :: exit 0 pnpm --filter @objectstack/spec run check:skill-docs :: exit 0 pnpm check:agent-test-spelling :: exit 0 pnpm check:changeset-gate-self-tests :: exit 0 pnpm check:ci-filter-parity :: exit 0 pnpm check:closed-ceremony-text :: exit 0 pnpm check:corpus-claim-drift :: exit 0 pnpm check:cross-package-test-inputs :: exit 0 pnpm check:doc-authoring :: exit 0 pnpm check:driver-memory-census :: exit 0 pnpm check:dts-closure :: exit 0 pnpm check:dual-build-cjs-loads :: exit 0 pnpm check:gitlink-declared :: exit 0 pnpm check:lean-entry-closure :: exit 0 pnpm check:merge-driver :: exit 0 pnpm check:nul-bytes :: exit 0 pnpm check:pm-governed-merges :: exit 0 pnpm check:pm-skill-id-lint :: exit 0 pnpm check:published-files :: exit 0 pnpm check:refd-timer-probe :: exit 0 pnpm check:role-word :: exit 0 pnpm check:skill-compatibility :: exit 0 pnpm check:skill-frame-sync :: exit 0 pnpm check:skill-identifier-liveness :: exit 0 pnpm check:skill-links :: exit 0 pnpm check:sourcemap-no-sources-content :: exit 0 pnpm check:watch-hint-literal :: exit 0 pnpm --filter @objectstack/spec check:skill-examples :: exit 0 pnpm --filter @objectstack/spec check:skill-refs :: exit 0 ``` </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01ADHkmSpA1arrHg2f7Nwofb)_ <!-- signed: domain:skills#2 · os-steve · session_01ADHkmRxXmVQ41fqnaTPGAv --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 4f20614 commit b33365c

3 files changed

Lines changed: 32 additions & 6 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): `objectstack-i18n` teaches `i18n.sourceLocale`
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
The `objectstack-i18n` skill now teaches the optional `i18n.sourceLocale` key: the language the inline `label:` text is written in, which `os lint`, `os i18n check` and `os i18n extract` read (`i18n.sourceLocale`, else `i18n.defaultLocale`, else `en`; `--default-locale` overrides it for one run). `defaultLocale` is described as what it is, the locale a user who has not chosen one gets, so an app authored in English for Chinese users declares `defaultLocale: 'zh-CN', sourceLocale: 'en'`. The skill also states the current serving behaviour: label serving still reads inline text as `defaultLocale` text, so that stack declares `fallbackLocale: 'en'` to keep an `en` request on the authored labels. The coverage and extract sections say "source locale" where they said "default locale", and a new eval case grades the configuration.

‎skills/objectstack-i18n/SKILL.md‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,16 @@ export default defineStack({
4242

4343
| Property | Type | Required / Default | Description |
4444
|:---------|:-----|:-------------------|:------------|
45-
| `defaultLocale` | `string` | **required** | Default BCP-47 locale code |
45+
| `defaultLocale` | `string` | **required** | The locale a user who has not chosen one gets |
46+
| `sourceLocale` | `string` | optional, defaults to `defaultLocale` | The language inline `label:` text is written in; read by `os lint`, `os i18n check`, `os i18n extract` |
4647
| `supportedLocales` | `string[]` | **required** | All supported locales |
4748
| `fallbackLocale` | `string` | optional | Fallback when translation missing |
4849

50+
An app authored in English for Chinese users declares `defaultLocale: 'zh-CN', sourceLocale: 'en'`,
51+
not an English `defaultLocale`. ⚠️ Label serving still reads inline text as `defaultLocale` text: with no
52+
`fallbackLocale: 'en'`, an `en` request reaches the zh-CN bundle before the English inline label.
53+
`sourceLanguage`, `authoringLocale` and `authoringLanguage` are refused, each naming `sourceLocale`.
54+
4955
---
5056

5157
## Authoring Translation Bundles (`objects.*`)
@@ -300,7 +306,7 @@ It compares registered bundles against source metadata and reports missing keys
300306
per locale for every surface the extractor walks — objects and their sub-keys,
301307
global actions, apps, dashboards, pages, flow screens. The platform's metadata
302308
forms count only for a stack that ships their translations (`--include-platform`
303-
audits them anyway). Gaps in the default locale are errors, `--strict` promotes
309+
audits them anyway). Gaps in the source locale are errors, `--strict` promotes
304310
the rest, `--show-keys` lists them all; `os lint --i18n-strict` folds it in.
305311

306312
### `os i18n extract --check` — freshness, not coverage
@@ -416,10 +422,10 @@ os i18n extract --locales=zh-CN --out=./src/translations
416422

417423
This writes `<locale>.objects.generated.ts` TypeScript modules (not JSON), plus a
418424
`<locale>.metadata-forms.generated.ts` companion unless `--no-metadata-forms` —
419-
the default locale is filled from schema labels, other locales follow `--fill`
420-
(`empty | default | todo`). `os i18n extract --help` lists the rest: `--filter`,
421-
`--default-locale`, `--no-merge`, `--objects-only`, `--source-hashes`, `--dry-run`,
422-
`--json`, …
425+
the source locale is filled from schema labels, other locales follow `--fill`
426+
(`empty | default | todo`). `--default-locale` overrides the source locale for one run
427+
(`i18n.sourceLocale`, else `i18n.defaultLocale`, else `en`). `os i18n extract --help` lists
428+
the rest: `--filter`, `--no-merge`, `--objects-only`, `--source-hashes`, `--dry-run`, `--json`, …
423429

424430
⚠️ **`--objects-only` is on by DEFAULT**, so extract writes only the `objects` /
425431
`globalActions` subtree — while `os i18n check` also demands `app`, `navigation`,

‎skills/objectstack-i18n/evals/bundles-locales-coverage.json‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,16 @@
100100
"must_contain": ["_actions", "crm_renew", "preflight", "fields", "verdict.summary"],
101101
"must_not_contain": ["title:", "verdict: {"]
102102
}
103+
},
104+
{
105+
"id": 11,
106+
"prompt": "Our app's metadata is authored in English — every inline `label:` is English — but it is sold to Chinese users, who should get Chinese without choosing a language. How do we declare the stack's `i18n` config?",
107+
"expected_output": "Declare `sourceLocale: 'en'` beside `defaultLocale: 'zh-CN'` in the stack's `i18n` block, with `zh-CN` in `supportedLocales`: `defaultLocale` is the locale a user who has not chosen one gets, `sourceLocale` the language the inline labels are written in. `os lint`, `os i18n check` and `os i18n extract` then treat `en` as the source — extract fills the `en` bundle from the inline text, and the rows the tooling asks for are the zh-CN ones. Also declare `fallbackLocale: 'en'`: label serving still reads inline text as `defaultLocale` text, so without it an `en` request reaches the zh-CN bundle before the English inline label.",
108+
"files": [],
109+
"assertions": {
110+
"must_contain": ["sourceLocale", "defaultLocale: 'zh-CN'", "fallbackLocale: 'en'", "supportedLocales"],
111+
"must_not_contain": ["defaultLocale: 'en'", "sourceLocale: 'zh-CN'"]
112+
}
103113
}
104114
]
105115
}

0 commit comments

Comments
 (0)