Skip to content

Commit 81c0947

Browse files
docs(skills): teach the mappings group, action and hook texts, and drop the stale label-serving caveat (#35302)
<!-- claude-projects-attribution: {"github_login":"os-bill"} --> _Requested by **Bill** · [project thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wg1XdbbGasMNVx41tq3hZKV4)_ Fixes #34962 Fixes #35097 Fixes #34053 Part of #34546 — this PR carries its i18n half only (where a hook's `texts` sit in a bundle, plus one i18n eval case). The declaration half (hook `texts` and `ctx.text` in `skills/objectstack-data/references/data-hooks.md`, plus one objectstack-data eval case) rides with the area's data-hooks group, per the PM's fence ruling in this dispatch: that file and the data eval set sit under open draft #34964 and the next data-hooks group. Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:已发布技能 `objectstack-i18n` 的顶层分组列表加入 `mappings`(导入映射的 `label`,按映射 `name` 存放,附 showcase 的 zh-CN 实例);"按组织语言取句"一段扩到钩子与脚本动作在 `texts` 里声明、用 `ctx.text` 写入记录的句子(`hooks.HOOK.texts.KEY.message`、`_actions.ACT.texts.KEY.message`,无对象动作在 `globalActions` 下);删去已失效的"标签服务把内联文字当 `defaultLocale` 读"提醒,只保留仍然成立的一句:校验与拒绝消息仍经 `t()` 读标签,英文源、中文默认的应用仍需声明 `fallbackLocale: 'en'`。`objectstack-ui` 的 `rules/actions.md` 新增一小节,教脚本动作声明 `texts` 并用 `ctx.text` 取句。i18n 评测加 2 条、改 1 条,ui 评测加 1 条。 - 为什么改:`mappings` 分组、动作 `texts`、钩子 `texts` 都已在 main 上落地,但技能没教;照技能写包的 agent 会把映射名留成英文、把句子硬编码进动作体。旧提醒在 sourceLocale 服务落地后已经说错。 - 风险与回滚:只改发布技能文字、评测、一行 token 棘轮与 changeset;无运行时影响。`rules/actions.md` 的棘轮行 3180 → 3333(先删同文件两处复述示例的句子 53 字节,余额按实测);i18n SKILL.md 在原上限内付清(6327 → 6329,上限 6333 不动)。回滚 = revert 本 PR。 - 先看:① `skills/objectstack-i18n/SKILL.md` 第 50–53 行(新的 `t()` 提醒是否准确)与分组段(`mappings`、`texts` 键);② `skills/objectstack-ui/rules/actions.md` 新增的 `texts` 小节;③ `scripts/check-skills-token-ratchet.mjs` 中 actions.md 行的注释与 +153。 - 两分钟验证:`node scripts/check-skills-token-ratchet.mjs`,预期 `skills/objectstack-ui/rules/actions.md is 3333 tokens (ceiling 3333; headroom 0)`、`skills/objectstack-i18n/SKILL.md is 6329 tokens (ceiling 6333; headroom 4)`,末行 ✓。 - 需要你做的:审阅并合并(`skills/**` 属 Tier H 受管面)。 ## What changes - `skills/objectstack-i18n/SKILL.md` - The top-level group list names `mappings` (`mappings.{mapping}.label`, an import mapping's `label` by its `name`; a mapping declares no description). The zh-CN example block gains the showcase's `mappings: { showcase_inquiry_feed: { label: … } }`, the spelling `examples/app-showcase` ships. (#34962) - The paragraph on keys picked in the organization's language (it already carried the flow record-write key) now covers each sentence a hook or a `script` action declares in `texts` and writes through `ctx.text`: `hooks.{hook}.texts.{key}.message` and `_actions.{action_name}.texts.{key}.message`, also under `globalActions`. The skill states the bundle shape only. The declaration, the `ctx.text` lookup and the missing-key behaviour live in the ui actions rule (and, for hooks, the data-hooks group), so nothing is said a third time. (#35097, #34546 i18n half) - The caveat "Label serving still reads inline text as `defaultLocale` text …" is gone. The `sourceLocale` row now says a request in that locale is served the inline text. The remaining truth is kept, measured on `origin/main` `01889892` (see Acceptance notes): validation and refusal messages still read labels through `t()`, which falls back to `fallbackLocale`, else `defaultLocale`. Without `fallbackLocale: 'en'`, an `en` refusal names a field by its zh-CN row. (#34053) - `skills/objectstack-ui/rules/actions.md`: a new H3 "Writing in the organization's language (`texts`)" after the refusals paragraph. The same actions that may declare `refusals` (a `script` action with a `js` body) declare a sentence under `texts` and ask for it with `await ctx.text(key, params)`. It is answered in the organization's language, never the caller's. With no translation the declared sentence is written, filled. An unreadable Localization setting rejects. An undeclared key is refused at save when named literally, else at run. The H3 names the `texts.KEY.message` key beside the refusals key, which the refusals paragraph still spells in full. The wording comes from `content/docs/ui/actions.mdx` as merged with the action-texts carrier. (#35097) - Evals - `skills/objectstack-i18n/evals/bundles-locales-coverage.json`: case 14 (`mappings.lead_csv.label`), case 15 (a hook's `texts` key and whose language picks it; it does not require the `{{ lead }}` hole), and case 11's `expected_output` now gives the `t()` reason for `fallbackLocale: 'en'`. Its `must_contain` keeps `fallbackLocale: 'en'`, decided below. - `skills/objectstack-ui/evals/views-apps-actions-pages.json`: case 21 (the `send_email` action's subject via `texts` + `ctx.text`; it does not forbid the prompt's own `'Email: ' +`). - `scripts/check-skills-token-ratchet.mjs`: the `rules/actions.md` row 3180 -> 3333 with its row note. The i18n row is untouched. - `.changeset/34962-i18n-skill-texts.md`: `@objectstack/skills` patch, carrying both declaration lines. ### Ratchet and size readings Raise authority, quoted verbatim and untranslated: the standing ruling of 2026-10-27, 「A:先削重复,余额按实测提高」, made the gate-recognised path by ruling record 6513306068 (letter B). Restatement in the same file is cut first; the remainder moves by measurement. - `skills/objectstack-i18n/SKILL.md`: paid in full in the same file, so the row does not move (open draft #34970 edits the same file). The restatement cut: - the renamed-target sentence, which restates the option paragraph's "parse, ship, and resolve to nothing" and the `translation-target-unknown` error stated just above it; - `--objects-only` and `--source-hashes` from the `extract --help` list, both taught in place (the paragraph right below and the Register code comment); - the group-name list in the `--objects-only` paragraph and the surface list in `os i18n check`'s paragraph, two partial copies of the group list (neither named `mappings`, `hooks` or `books`); - the empty step "### 2. Translate / Fill in the values manually."; - the flow-key language parenthetical, merged into the one sentence that now also covers `texts`. - `skills/objectstack-ui/rules/actions.md`: paid down first by 53 bytes of restatement, each of the example right below its sentence: " as `${result.output.NAME}`" in the `onSuccess` sentence (27; the Convert Lead block spells `${result.output.opportunity_id}`) and "`{recordId}` placeholder; " in the `newTabUrl` sentence (26; the Open PDF block spells it). The refusals bundle key stays: the bundle's own evals grade `_actions`, and the with-skill arm reads this bundle only. Nothing else in the file restates another passage, so the rest moves by measurement: 12720 -> 13330 bytes, `ceil(13330 / 4) == 3333`, +153 tokens, pinned AT the measurement. | Reading (tree `objectstack-ai/objectstack`, base `01889892` -> head 14899df) | Before | After | |:--|--:|--:| | `skills/objectstack-i18n/SKILL.md` lines | 527 | 523 | | `skills/objectstack-i18n/SKILL.md` bytes / priced tokens (ceiling) | 25325 / 6327 (6333) | 25336 / 6329 (6333) | | `skills/objectstack-ui/rules/actions.md` lines | 248 | 258 | | `skills/objectstack-ui/rules/actions.md` bytes / tokens (ceiling) | 12720 / 3180 (3180) | 13330 / 3333 (3333) | | All published `skills/*/SKILL.md` lines (sum, 13 files) | 4835 | 4831 | | All published `skills/*/SKILL.md` bytes (sum) | 254161 | 254172 | | Bundle total, whole shipped tree (ratchet units) | 270968 | 271945 | The bundle total's +977 units are mostly eval fixtures (+822, measured, not ratcheted). ## Tests Text-only change to served skill text, eval fixtures and one ratchet row. No tested behaviour changed, so there is no ablation and no package `test` / `typecheck` is owed (the diff touches no package source). <details><summary>Token ratchet, gate and self-test (head 14899df)</summary> ``` node scripts/check-skills-token-ratchet.mjs -> exit 0 ✓ check-skills-token-ratchet: skills/objectstack-i18n/SKILL.md is 6329 tokens (ceiling 6333; headroom 4). ✓ check-skills-token-ratchet: skills/objectstack-ui/rules/actions.md is 3333 tokens (ceiling 3333; headroom 0). ✓ check-skills-token-ratchet: 59 authored bundle file(s) within their ceilings; 10 generator-owned file(s) and 38 eval fixture(s) measured, not ratcheted. node scripts/check-skills-token-ratchet.mjs --self-test -> exit 0 ✓ check-skills-token-ratchet self-test: 104 cases pass. ``` Before the row was re-pinned, the same gate read `3333 / 3180 (+153)` and exited 1: the remainder this PR carries. </details> ## Acceptance notes - **A3 measured false.** The automation skill does not teach hooks. `skills/objectstack-automation/SKILL.md:9` sends object-layer lifecycle hooks to objectstack-data, and hooks, their `refusals` catalogue and its translation key are taught in `skills/objectstack-data/references/data-hooks.md` (§ Error Handling → Declared refusals). That file is outside this dispatch's fence, and per the PM it belongs to the data-hooks group. The automation skill is untouched. - **The #34053 decision: case 11 keeps `fallbackLocale: 'en'` as a required string, with its reason rewritten.** Serving honours `sourceLocale` (the carrier merged as `2068e037`). But #34030 is still open: validation and refusal messages read labels through `t()`. Read on `origin/main` `01889892`: `resolveFieldLabel` (`packages/objectql/src/validation/record-validator.ts:463`) asks `ctx.translate` before the declared label, and `FileI18nAdapter.t()` (`packages/services/service-i18n/src/file-i18n-adapter.ts:176-181`) falls back to `fallbackLocale`, which the stack config fills as `fallbackLocale || defaultLocale || 'en'`. So in an English-source app with a zh-CN default, `fallbackLocale: 'en'` still keeps an `en` refusal off the zh-CN row. When #34030 lands, its own skills follow-up drops the sentence and the requirement. This is a reading of the tree; no request was run. - `skills/objectstack-ui/evals/README.md` lists each eval file's topics broadly. It is not extended for the new case. ## Verification Local gate union derived by `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` at head 81eae9a (6 paths, 66 commands). Every family CI runs is read from this PR's check-runs. Fix round `14899df1c` (contract review 6999139326, M1) re-ran the token ratchet and its self-test, the skills gates (`check:skill-docs`, `check:skill-refs`, `check:skill-links`, `check:skill-identifier-liveness`, `check:skill-compatibility`, `check:skill-frame-sync`), `check:nul-bytes`, `check:doc-authoring`, `check:pm-skill-id-lint`, the changeset gates and overlap-check: all exit 0. `check:doc-formula-expressions` was NOT MEASURED there (no lint dist in the recreated worktree; no code block touched; exit 0 at 81eae9a). <details><summary>Local run (head 81eae9a)</summary> ``` Run reconciliation: 66 derived, 64 run (exit 0), 2 NOT-MEASURED, 0 UNRUN. ✓ dispatch-gates --ran: 66 derived famil(ies) accounted for — 64 run, 2 NOT-MEASURED (2 DERIVED from a recorded exit 3). pnpm --filter @objectstack/spec run check:skill-docs -> exit 0 ✅ Skill docs in sync pnpm --filter @objectstack/spec run check:skill-refs -> exit 0 ✅ 9 generated files in sync with packages/spec pnpm check:skill-links -> exit 0 267 relative link(s) in 73 published skill file(s) resolve; 138 fragment(s) name a real heading pnpm check:skill-identifier-liveness -> exit 0 Leg 1: 484 citation(s) over 73 published file(s); Leg 2: 11 registered exhaustive section(s), 0 ledgered gap(s) pnpm check:skill-compatibility -> exit 0 13 SKILL.md file(s) reconciled against 91 workspace packages pnpm check:doc-authoring -> exit 0 pnpm check:pm-skill-id-lint -> exit 0 120 file(s) clean pnpm check:nul-bytes -> exit 0 no raw ASCII control bytes pnpm check:pm-dispatch-gates -> exit 0 fast tier: 2249 cases pass pnpm --filter @objectstack/lint run check:doc-formula-expressions -> exit 0 (after building the @objectstack/lint closure) pnpm check:dual-build-cjs-loads -> exit 3 PREREQUISITE NOT MET (needs every package's built dist/) pnpm check:lean-entry-closure -> exit 3 PREREQUISITE NOT MET (needs the objectql build) ``` </details> NOT MEASURED locally: `check:dual-build-cjs-loads` and `check:lean-entry-closure`. Reason: PREREQUISITE NOT MET (exit 3). They load built `dist/` trees that this docs-only diff does not build, and CI runs them. No package `test` / `typecheck` is owed, and no `test:repo` either: the diff touches no package source and no repo-project test. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Utp6CazXu8zyYD5PC6J2u7 <!-- signed: repo:objectstack#5 · os-bill · session_01Utp6CazXu8zyYD5PC6J2u7 --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 084f606 commit 81c0947

6 files changed

Lines changed: 92 additions & 27 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): the i18n and ui skills teach the `mappings` translation group, an action's `texts` and where hook and action texts sit in a bundle; the stale label-serving caveat is gone
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
- `objectstack-i18n`: the top-level group list names `mappings` (`mappings.{mapping}.label`, an import mapping's label by its `name`). The paragraph on keys picked in the organization's language now covers the sentences a hook or a `script` action declares in `texts` and writes through `ctx.text`: `hooks.{hook}.texts.{key}.message` and `_actions.{action_name}.texts.{key}.message`, also under `globalActions`.
11+
- `objectstack-i18n`: the caveat that label serving reads inline text as `defaultLocale` text is removed, because serving honours `i18n.sourceLocale`. What is still true stays: validation and refusal messages read labels through `t()`, which falls back to `fallbackLocale`, else `defaultLocale`, so an English-source app with a zh-CN default still declares `fallbackLocale: 'en'`.
12+
- `objectstack-ui` `rules/actions.md`: a `script` action declares a sentence it writes into a record under `texts` and asks for it with `ctx.text`. The rule covers the organization's language, the `texts.<key>.message` key beside the refusals key, a missing translation, an unreadable Localization setting and an undeclared key. Two sentences that restated the example below them are shorter.
13+
- `objectstack-i18n` pays for its new text in the same file. It drops a sentence that restated the option-key paragraph, two flags from the `extract --help` list that are taught in place, two partial copies of the group list, and the empty "Translate" step.
14+
- Evals: the i18n set gains a `mappings` case and a hook-texts bundle-key case, and case 11 states the remaining `t()` reason for `fallbackLocale: 'en'`. The ui set gains an action `texts` case.

‎scripts/check-skills-token-ratchet.mjs‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,22 @@ export const CEILINGS = new Map([
14481448
// in the text that row moved in). Same ruling as the lines above (2026-10-27, tap A):
14491449
// 「A:先削重复,余额按实测提高」 (ruling record 6513306068).
14501450
// ceil($(wc -c < skills/objectstack-ui/rules/actions.md) / 4) == ceil(12720 / 4)
1451-
['skills/objectstack-ui/rules/actions.md', 3180],
1451+
// 3180 -> 3333 (#35097): a script action writes a sentence in the organization's language.
1452+
// One H3 after the refusals paragraph: declare it under `texts`, ask for it with `ctx.text`, the
1453+
// missing-translation and unreadable-setting answers, when an undeclared key is refused, and the
1454+
// `texts.<key>.message` key beside the refusals key the paragraph above spells (that key stays:
1455+
// the bundle's evals grade `_actions` and the with-skill arm reads this bundle only). PAID DOWN
1456+
// FIRST by 53 bytes of restatement in this file, each of an example right below its sentence:
1457+
// " as `${result.output.NAME}`" in the `onSuccess` sentence (27; the Convert Lead block's
1458+
// `${result.output.opportunity_id}` shows the spelling) and "`{recordId}` placeholder; " in the
1459+
// `newTabUrl` sentence (26; the Open PDF block's `newTabUrl: '/api/v1/invoice/{recordId}/pdf'`
1460+
// shows it). Nothing else in the file restates another passage (see the 2777 -> 2808 note
1461+
// above), so the same ruling's second half carries the rest. Arithmetic: the text adds 663
1462+
// bytes, the cuts remove 53, so the file is 12720 -> 13330 bytes -> 3333 tokens, zero headroom
1463+
// before, ceiling +153, the measured remainder only, pinned AT the measurement. Same ruling
1464+
// (2026-10-27, tap A): 「A:先削重复,余额按实测提高」 (ruling record 6513306068, letter B).
1465+
// ceil($(wc -c < skills/objectstack-ui/rules/actions.md) / 4) == ceil(13330 / 4)
1466+
['skills/objectstack-ui/rules/actions.md', 3333],
14521467
// 6090 -> 6252 (#19715, card item 4): a 5-line table of contents at the top,
14531468
// anchors to the file's existing headings, nothing else changed. +162 tokens,
14541469
// zero headroom to absorb any of it, ceiling +162. Maintainer ruling

‎skills/objectstack-i18n/SKILL.md‎

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,14 @@ export default defineStack({
4343
| Property | Type | Required / Default | Description |
4444
|:---------|:-----|:-------------------|:------------|
4545
| `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` |
46+
| `sourceLocale` | `string` | optional, defaults to `defaultLocale` | The language inline `label:` text is written in: a request in it is served that text; read by `os lint`, `os i18n check`, `os i18n extract` |
4747
| `supportedLocales` | `string[]` | **required** | All supported locales |
4848
| `fallbackLocale` | `string` | optional | Fallback when translation missing |
4949

5050
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.
51+
not an English `defaultLocale`. ⚠️ Validation and refusal messages still read labels through `t()`, which
52+
falls back to `fallbackLocale`, else `defaultLocale`: without `fallbackLocale: 'en'` an `en` refusal names
53+
a field by its zh-CN row.
5354
`sourceLanguage`, `authoringLocale` and `authoringLanguage` are refused, each naming `sourceLocale`.
5455

5556
---
@@ -179,7 +180,8 @@ picklist inherits them), `dashboards`, `datasets`, `reports`, `pages`, `flows`,
179180
spine, by `Book.name`: `books.{book}.label` / `.description`, and `groups.{group_key}.label` by
180181
each group's stable `key`, never its position — `books.crm_manual.groups.getting_started.label`;
181182
the pages themselves localize through `doc.translations`, and the inline `translations` map a
182-
book once carried stays retired), `metadataForms`, `settingsCommon`; `reports`, `positions` and
183+
book once carried stays retired), `mappings` (an import mapping's `label` by its `name`:
184+
`mappings.{mapping}.label`), `metadataForms`, `settingsCommon`; `reports`, `positions` and
183185
`permissions` hold `label` + `description` by name, so do `datasets` and each dataset member at
184186
`datasets.{dataset}.{dimensions,measures}.{member}` (a member's `synonyms` have no key: one
185187
authored list carries every language), and a joined report's block headings sit at
@@ -188,17 +190,20 @@ Three keys sit deeper than their group's `label`: a `page:tabs` item at
188190
`pages.{page}.components.{tabs_id}.items.{value}.label` (by the item's `value`; an item without
189191
one has no key), an approval step at `flows.{flow}.approvals.{node_id}.label`, and the text a
190192
`create_record` / `update_record` writes into a field marked `{ dialect: 'template', source }` at
191-
`flows.{flow}.records.{node_id}.fields.{field}`, picked in the organization's language (the
192-
Localization setting if set, else `i18n.defaultLocale`; never the run starter's).
193+
`flows.{flow}.records.{node_id}.fields.{field}`. That text, and each sentence a hook or a `script`
194+
action declares in `texts` and writes through `ctx.text` — `hooks.{hook}.texts.{key}.message`,
195+
`_actions.{action_name}.texts.{key}.message` (also under `globalActions`) — is picked in the
196+
organization's language (the Localization setting if set, else `i18n.defaultLocale`; never the caller's).
193197
`os i18n extract --no-objects-only` scaffolds every group above but `messages` and
194-
`settingsCommon`, all three keys included. The `inlineTitle`, report-block and table-column
195-
keys, as the shipped `app-crm`, `app-showcase` and platform bundles spell them for `zh-CN`
198+
`settingsCommon`, all three keys included. The `inlineTitle`, report-block, table-column and
199+
mapping keys, as the shipped `app-crm`, `app-showcase` and platform bundles spell them for `zh-CN`
196200
(`rows` is the table field's `path`, `error.message` one column's):
197201

198202
```typescript
199203
objects: { crm_opportunity_line_item: { fields: { opportunity: { inlineTitle: '产品明细' } } } },
200204
reports: { showcase_task_overview: { blocks: { open_block: { label: '未完成任务' } } } },
201205
objects: { sys_user: { _actions: { import_sso_users: { resultDialog: { columns: { rows: { email: '邮箱', 'error.message': '未添加的原因' } } } } } } },
206+
mappings: { showcase_inquiry_feed: { label: '询盘导入(营销 CSV)' } },
202207
```
203208

204209
`settings` is **platform-only** — it is keyed by a settings manifest's namespace and only
@@ -234,9 +239,7 @@ whose column path that field's `columns[]` does not list;
234239
under an action that declares neither `confirmText` nor a non-empty `params` — a bundle
235240
translates a dialog the action declares and cannot add one. A
236241
param's inline option keys share the option warning with a field's `options`; a param that
237-
references a `field` and declares no inline `options` is not judged. A bundle keyed to
238-
something since renamed still parses — the label just renders silently in its source locale
239-
while every neighbouring one resolves.
242+
references a `field` and declares no inline `options` is not judged.
240243

241244
---
242245

@@ -305,8 +308,7 @@ os i18n check --strict --threshold=95 # CI gate: locale parity + minimum covera
305308
```
306309

307310
It compares registered bundles against source metadata and reports missing keys
308-
per locale for every surface the extractor walks — objects and their sub-keys,
309-
global actions, apps, dashboards, pages, flow screens. The platform's metadata
311+
per locale for every surface the extractor walks. The platform's metadata
310312
forms count only for a stack that ships their translations (`--include-platform`
311313
audits them anyway). Gaps in the source locale are errors, `--strict` promotes
312314
the rest, `--show-keys` lists them all; `os lint --i18n-strict` folds it in.
@@ -426,19 +428,13 @@ This writes `<locale>.objects.generated.ts` TypeScript modules (not JSON), plus
426428
the source locale is filled from schema labels, other locales follow `--fill`
427429
(`empty | default | todo`). `--default-locale` overrides the source locale for one run
428430
(`i18n.sourceLocale`, else `i18n.defaultLocale`, else `en`). `os i18n extract --help` lists
429-
the rest: `--filter`, `--no-merge`, `--objects-only`, `--source-hashes`, `--dry-run`, `--json`, …
431+
the rest: `--filter`, `--no-merge`, `--dry-run`, `--json`, …
430432

431433
⚠️ **`--objects-only` is on by DEFAULT**, so extract writes only the `objects` /
432-
`globalActions` subtree — while `os i18n check` also demands `app`, `navigation`,
433-
`dashboard`, `widget`, `dataset`, `report`, `picklist`, `page`, `flow`, `position` and
434-
`permission` keys. Pass `--no-objects-only` to include those
435-
groups, or author them by hand.
434+
`globalActions` subtree while `os i18n check` still asks for the other groups: pass
435+
`--no-objects-only`, or author them by hand.
436436

437-
### 2. Translate
438-
439-
Fill in the values manually.
440-
441-
### 3. Register
437+
### 2. Register
442438

443439
A stack registers its bundles with `defineStack({ translations: [...] })`. A **package or
444440
plugin shipping its own generated bundle** — the most common shape in this repo — has one

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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
{
115115
"id": 11,
116116
"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?",
117-
"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.",
117+
"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. Label serving then answers an `en` request from the English inline label. Also declare `fallbackLocale: 'en'`: validation and refusal messages still read labels through `t()`, which falls back to `fallbackLocale`, else `defaultLocale`, so without it an `en` refusal names a field by its zh-CN row.",
118118
"files": [],
119119
"assertions": {
120120
"must_contain": ["sourceLocale", "defaultLocale: 'zh-CN'", "fallbackLocale: 'en'", "supportedLocales"],
@@ -130,6 +130,26 @@
130130
"must_contain": ["_actions", "import_leads", "resultDialog.columns.rows", "error.message"],
131131
"must_not_contain": ["error: {"]
132132
}
133+
},
134+
{
135+
"id": 14,
136+
"prompt": "Our package ships a named import mapping `lead_csv` with `label: 'Lead CSV (standard)'`. zh-CN users still see that English label in the import wizard's saved-mapping picker. Where does the translation go?",
137+
"expected_output": "`mappings.lead_csv.label` in the zh-CN `TranslationData`: `mappings` is a top-level group beside `objects`, keyed by the mapping's `name` — `mappings: { lead_csv: { label: '线索 CSV(标准)' } }`. `label` is the only key (a mapping declares no description). The mapped fields' own labels stay under `objects.<object>.fields.<field>.label`. Not an `objects` entry and not a `messages` key.",
138+
"files": [],
139+
"assertions": {
140+
"must_contain": ["mappings", "lead_csv", "label"],
141+
"must_not_contain": ["objects: { lead_csv", "messages: {"]
142+
}
143+
},
144+
{
145+
"id": 15,
146+
"prompt": "The `lead_follow_up` hook declares `texts: { follow_up_subject: { message: 'Follow up with qualified lead: {{ lead }}', params: ['lead'] } }` and writes a task subject with `ctx.text('follow_up_subject', { lead: ctx.input.name })`. Our organization works in zh-CN, but the tasks still read English. Which bundle key translates it, and whose language is picked?",
147+
"expected_output": "`hooks.lead_follow_up.texts.follow_up_subject.message` in the zh-CN bundle, keyed by the hook's `name` (not under `objects` or `messages`), the translation keeping its `{{ lead }}` hole, which the runtime fills after picking it: `'跟进已确认的线索:{{ lead }}'`. It is picked in the organization's language — the Localization setting if somebody set it, else `i18n.defaultLocale` — never the language of the person whose save fired the hook.",
148+
"files": [],
149+
"assertions": {
150+
"must_contain": ["hooks", "lead_follow_up", "texts", "follow_up_subject", "defaultLocale"],
151+
"must_not_contain": ["messages: {", "_hooks"]
152+
}
133153
}
134154
]
135155
}

‎skills/objectstack-ui/evals/views-apps-actions-pages.json‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,16 @@
200200
"must_contain": ["refusals", "NOT_DRAFT", "409", "_actions"],
201201
"must_not_contain": ["hooks.submit_signoff"]
202202
}
203+
},
204+
{
205+
"id": 21,
206+
"prompt": "The `send_email` script action on `crm_contact` logs a `crm_activity` whose subject its `js` body builds as `'Email: ' + input.subject`. Our organization works in zh-CN, but every logged subject reads English. Make the subject follow the organization's language.",
207+
"expected_output": "The action declares `texts: { email_subject: { message: 'Email: {{ subject }}', params: ['subject'] } }` and the body writes `const subject = await ctx.text('email_subject', { subject: input.subject });` instead of concatenating. The sentence is answered in the organization's language (the Localization setting if somebody set it, else `i18n.defaultLocale`), never the language of the person who pressed the button, and translated at `objects.crm_contact._actions.send_email.texts.email_subject.message`, the translation keeping its `{{ subject }}` hole. With no translation the declared sentence is written. A key `texts` does not declare is refused. Not a locale branch in the body, and not a `messages` lookup.",
208+
"files": [],
209+
"assertions": {
210+
"must_contain": ["texts", "email_subject", "ctx.text", "_actions"],
211+
"must_not_contain": ["hooks.send_email"]
212+
}
203213
}
204214
]
205215
}

‎skills/objectstack-ui/rules/actions.md‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export const ReassignLeadAction = defineAction({
6464

6565
## Examples
6666

67-
`onSuccess` hops once the flow run completes, not when it pauses at a screen; its URL template reads an `isOutput` variable as `${result.output.NAME}`:
67+
`onSuccess` hops once the flow run completes, not when it pauses at a screen; its URL template reads an `isOutput` variable:
6868

6969
<!-- os:check -->
7070
```typescript
@@ -141,6 +141,16 @@ sentence is answered as `userMessage`, translated at
141141
`objects.<object>._actions.<action>.refusals.<CODE>.message` (objectstack-i18n); the console's
142142
failure toast shows it unless the action authors `errorMessage`.
143143

144+
### Writing in the organization's language (`texts`)
145+
146+
A sentence the body writes into a record (an activity's subject) is read organization-wide:
147+
the same actions declare it under `texts` and ask for it by key —
148+
`texts: { email_subject: { message: 'Email: {{ subject }}', params: ['subject'] } }`, then
149+
`await ctx.text('email_subject', { subject: input.subject })`. It answers in the organization's
150+
language, never the caller's, translated at the same node's `texts.<key>.message`; with no
151+
translation the declared sentence is written, filled; an unreadable Localization setting
152+
rejects. An undeclared key is refused at save when named literally, else at run.
153+
144154
## Opening in a New Tab
145155

146156
### `openIn: 'new-tab'`
@@ -168,7 +178,7 @@ export const PrintA3Action = defineAction({
168178
A redirect URL **computed after a fetch**: `opensInNewTab:
169179
true` pre-opens the tab synchronously on click (no popup blocker), then navigates
170180
it to the handler's `redirectUrl`. `newTabUrl` skips the round-trip — a backend
171-
path starting with `/` (`{recordId}` placeholder; an external URL is refused, use
181+
path starting with `/` (an external URL is refused, use
172182
`openIn`), valid only with `opensInNewTab: true`; the endpoint enforces its own
173183
auth (the tab carries no in-app session).
174184

0 commit comments

Comments
 (0)