Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/34917-skills-i18n-action-column-keys.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@objectstack/skills': patch
---

docs(skills): the i18n skill names the action table column label keys

Clause-②: no
Metadata-protocol: none

objectstack-i18n's SKILL.md lists `resultDialog.columns.{path}.{column_path}` and `preflight.columns.{path}.{column_path}` in the `_actions.{action_name}` row of its key table: the header labels of a `format: 'table'` answer field's columns, written beside `fields` and keyed by the table field's literal `path`, then by the literal `path` of one of its `columns[]`, each value a plain string. The `translation-target-unknown` paragraph gains the matching refusal (a field path that is no declared table field, or a column path the field's `columns[]` does not list), and the zh-CN example block shows the key as the platform's `sys_user` bundle spells it. One new eval case grades a result-dialog table whose headers stayed English, and the preflight eval case no longer says a `preflight` node holds only `fields`. The text is paid for in the same file by cutting five restatements, so the skill's token ceiling does not move.
31 changes: 12 additions & 19 deletions skills/objectstack-i18n/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ All translatable content for a single object is aggregated under
| `label` / `pluralLabel` / `description` | Object-level text (every key optional) |
| `fields.{field_name}` | `label`, `help`, `placeholder`, `options` (option value → label), `inlineTitle` (the heading of the inline child grid a `master_detail` field draws on its parent's form — the field lives on the child object, so the key is the child's; untranslated it keeps its authored text, never the child's plural label), `relatedListTitle` (the title of the related list a `lookup` or `master_detail` field draws on its parent's record page — the key is the child's too; untranslated it keeps its authored text, never the child's label) per field |
| `_views.{view_name}` | `label`, `description`, `title` (a form view's own heading — only a form that authors one is translated; a list view has none), `submitBehavior.title` / `submitBehavior.message` (the thank-you panel of a form whose `submitBehavior` is `kind: 'thank-you'`; only the copy the form authors is translated, and the other kinds carry none), `emptyState.title` / `emptyState.message`, `bulkActions.{def_name}` (`label`, `confirmText`, `confirmLabel`, `params`) |
| `_actions.{action_name}` | `label`, `description`, `confirmText`, `submitText` (the param dialog's button verb — only under an action that declares `params`), `cancelText` (the dismiss button of the confirm or param dialog — only under an action that declares `confirmText` or a non-empty `params`), `successMessage`, `disabledReason` (the sentence a greyed action shows; absent keeps the console's default), `params.{param_name}` (and `.options.{value}` beneath it — an option's stored `value` in that param's inline `options`), `outcomeMessages.{outcome}` (an outcome the action's own `outcomeMessages` declares), `resultDialog.title` / `.description` / `.acknowledge` (only under an action that declares a `resultDialog`), `resultDialog.fields.{path}` (the literal `path` of a field in `resultDialog.fields[]`, dots included — `client.secret` is one key), `preflight.fields.{path}` (only under an action that declares `preflight`: a field's literal `path` in its `preflight.fields[]`, its value a plain string as under `resultDialog.fields`; `defineTranslationBundle` refuses any other key under `preflight`, a `title` included); the same keys hold under `globalActions.{action_name}` |
| `_actions.{action_name}` | `label`, `description`, `confirmText`, `submitText` (the param dialog's button verb — only under an action that declares `params`), `cancelText` (the dismiss button of the confirm or param dialog — only under an action that declares `confirmText` or a non-empty `params`), `successMessage`, `disabledReason` (the sentence a greyed action shows; absent keeps the console's default), `params.{param_name}` (and `.options.{value}` beneath it — an option's stored `value` in that param's inline `options`), `outcomeMessages.{outcome}` (an outcome the action's own `outcomeMessages` declares), `resultDialog.title` / `.description` / `.acknowledge` (only under an action that declares a `resultDialog`), `resultDialog.fields.{path}` (the literal `path` of a field in `resultDialog.fields[]`, dots included — `client.secret` is one key), `preflight.fields.{path}` (only under an action that declares `preflight`: a field's literal `path` in its `preflight.fields[]`, its value a plain string as under `resultDialog.fields`), `resultDialog.columns.{path}.{column_path}` / `preflight.columns.{path}.{column_path}` (a table's column headers, beside `fields`: the literal `path` of a `format: 'table'` field, then of one of its `columns[]`, each a plain string; `defineTranslationBundle` refuses any other key under `preflight`, a `title` included); the same keys hold under `globalActions.{action_name}` |
| `_sections.{section_name}` | Form section `label`, `description`; `fields.{field_name}` — the `label`, `placeholder`, `helpText` an entry overrides for that form alone (`helpText` here, `help` under `fields.{field_name}` above: each spells what its source does) |
| `_tabs.{tab_name}` | Filter-preset tab `label` (`ViewTabSchema.name`) |
| `_validations.{rule_name}` | `message` only — the sentence a rejected write returns (replaces the retired `validationMessages`) |
Expand All @@ -190,21 +190,19 @@ one has no key), an approval step at `flows.{flow}.approvals.{node_id}.label`, a
`flows.{flow}.records.{node_id}.fields.{field}`, picked in the organization's language (the
Localization setting if set, else `i18n.defaultLocale`; never the run starter's).
`os i18n extract --no-objects-only` scaffolds every group above but `messages` and
`settingsCommon`, all three keys included. The `inlineTitle` and report-block keys, as the
shipped `app-crm` and `app-showcase` bundles spell them for `zh-CN`:
`settingsCommon`, all three keys included. The `inlineTitle`, report-block and table-column
keys, as the shipped `app-crm`, `app-showcase` and platform bundles spell them for `zh-CN`
(`rows` is the table field's `path`, `error.message` one column's):

```typescript
objects: { crm_opportunity_line_item: { fields: { opportunity: { inlineTitle: '产品明细' } } } },
reports: { showcase_task_overview: { blocks: { open_block: { label: '未完成任务' } } } },
objects: { sys_user: { _actions: { import_sso_users: { resultDialog: { columns: { rows: { email: '邮箱', 'error.message': '未添加的原因' } } } } } } },
```

`settings` is **platform-only** — it is keyed by a settings manifest's namespace and only
the platform declares one, so an app bundle carrying it is refused by name.

For the exact Zod shape (and any field that may have been added since), read
`node_modules/@objectstack/spec/src/system/translation.zod.ts` —
`TranslationDataSchema`, `ObjectTranslationDataSchema`, and `FieldTranslationSchema`.

---

## Naming Conventions
Expand All @@ -226,9 +224,10 @@ parse, ship, and resolve to nothing.
is an **error** and fails the run; `translation-option-key-unknown` is a warning.
A key naming an object, field, view, tab, action, param, section, validation rule, app,
nav item, dashboard, widget or flow screen that does not exist is listed alongside the names
that do. Five more shapes under an action entry are the error: an outcome the action does
that do. Six more shapes under an action entry are the error: an outcome the action does
not declare in `outcomeMessages`; a `resultDialog.fields` or `preflight.fields` path it does
not declare (an action with no `preflight` declares none);
not declare; a `columns` key whose field path is no declared `format: 'table'` field, or
whose column path that field's `columns[]` does not list;
`resultDialog` `title` / `description` / `acknowledge` under an action that declares no
`resultDialog`; `submitText` under an action with no non-empty `params`; and `cancelText`
under an action that declares neither `confirmText` nor a non-empty `params` — a bundle
Expand Down Expand Up @@ -287,9 +286,8 @@ what the runtime implements.)

### No ICU MessageFormat

There is no ICU MessageFormat engine — interpolation is always simple
`{{variable}}` substitution (the aspirational `messageFormat` config knob was
removed). To pluralize, select the form in application code before calling `t()`.
There is no ICU MessageFormat engine (the aspirational `messageFormat` config knob
was removed). To pluralize, select the form in application code before calling `t()`.

---

Expand Down Expand Up @@ -360,8 +358,7 @@ import type { II18nService } from '@objectstack/spec/contracts';
```

(The contract's source `.ts` is not part of the published package — only
`src/**/*.zod.ts` ships — so import the type from `@objectstack/spec/contracts`
rather than reading `node_modules` source.)
`src/**/*.zod.ts` ships — so there is no `node_modules` source to read.)

Methods implemented by both shipped adapters (`FileI18nAdapter` from
`@objectstack/service-i18n`, and the in-memory fallback `@objectstack/core`
Expand Down Expand Up @@ -440,11 +437,7 @@ groups, or author them by hand.

Fill in the values manually.

### 3. Verify Coverage

Run `os i18n check` (**Translation Coverage** above).

### 4. Register
### 3. Register

A stack registers its bundles with `defineStack({ translations: [...] })`. A **package or
plugin shipping its own generated bundle** — the most common shape in this repo — has one
Expand Down
12 changes: 11 additions & 1 deletion skills/objectstack-i18n/evals/bundles-locales-coverage.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
{
"id": 10,
"prompt": "In zh-CN the `crm_renew` action on `crm_opportunity` opens its param dialog with the rows of its pre-submit read still in English. Its `preflight.fields` declares the paths `amount` and `verdict.summary`.",
"expected_output": "`objects.crm_opportunity._actions.crm_renew.preflight.fields`, keyed by each declared field's literal `path`: `amount` and `'verdict.summary'` (one key, dots included, never split into nested objects), each value the translated label string itself, with no `.label`. The node holds nothing else: the panel has no heading of its own to translate, and `defineTranslationBundle` refuses any other key under `preflight`. A path the action's `preflight.fields` does not declare is `translation-target-unknown`.",
"expected_output": "`objects.crm_opportunity._actions.crm_renew.preflight.fields`, keyed by each declared field's literal `path`: `amount` and `'verdict.summary'` (one key, dots included, never split into nested objects), each value the translated label string itself, with no `.label`. Beside `fields` the node holds only `columns` (a table field's column headers): the panel has no heading of its own to translate, and `defineTranslationBundle` refuses any other key under `preflight`. A path the action's `preflight.fields` does not declare is `translation-target-unknown`.",
"files": [],
"assertions": {
"must_contain": ["_actions", "crm_renew", "preflight", "fields", "verdict.summary"],
Expand All @@ -110,6 +110,16 @@
"must_contain": ["sourceLocale", "defaultLocale: 'zh-CN'", "fallbackLocale: 'en'", "supportedLocales"],
"must_not_contain": ["defaultLocale: 'en'", "sourceLocale: 'zh-CN'"]
}
},
{
"id": 12,
"prompt": "In zh-CN the `import_leads` action on `crm_lead` shows the per-row table in its result dialog with English column headers, though `resultDialog.fields.rows` is translated. The `rows` field is `format: 'table'` and its `columns` declare the paths `email` and `error.message`. Which bundle key carries the headers?",
"expected_output": "`objects.crm_lead._actions.import_leads.resultDialog.columns.rows`, a sibling of `resultDialog.fields` and never nested inside the `rows` entry there, which stays the field's label string. It is keyed by the table field's literal `path`, then by each column's literal `path`: `email` and `'error.message'` (one key, dots included, never split into nested objects), each value the translated header string itself — `columns: { rows: { email: '邮箱', 'error.message': '原因' } }`. A preflight table takes the same shape under `preflight.columns`. A field path that is no declared `format: 'table'` field, or a column path that field's `columns` does not list, is `translation-target-unknown`.",
"files": [],
"assertions": {
"must_contain": ["_actions", "import_leads", "resultDialog.columns.rows", "error.message"],
"must_not_contain": ["error: {"]
}
}
]
}
Loading