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
12 changes: 12 additions & 0 deletions .changeset/36401-skills-i18n-flow-nodes-related-lists.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
'@objectstack/skills': patch
---

docs(skills): the i18n and data skills teach the flow step-name key `flows.FLOW.nodes.NODE_ID.label` and the related-list title key `objects.OBJECT._relatedLists.LIST.label`

Clause-②: no
Metadata-protocol: none

objectstack-i18n's SKILL.md, in the paragraph on the keys that sit deeper than their group's `label`, now names the flow step-name key `flows.FLOW.nodes.NODE_ID.label`: a screen is named through its heading `flows.FLOW.screens.NODE_ID.title` and takes a `nodes` key only beside a `title` of its own, `os i18n check` asks for a flow's top-level steps, and a step of one of the `FLOW_TECHNICAL_NODE_TYPES` (listed) is asked only where a decision's branch leads to it. Text only; paid inside the same file by cutting three restatements in the coverage and extract sections.

The object translation group table gains the `_relatedLists.LIST` row beside `_tabs`: the `label` of an object-form `relatedLists` entry on the parent object, keyed by the entry's literal `list` (a dotted `object.field` is one key); an entry with no `label` has no key and keeps the child field's `relatedListTitle`, else the child's plural label; the unprefixed `relatedLists` spelling is refused, naming the key. objectstack-data's `rules/relationships.md` says the same on the `relatedLists` entry: its `label` translates at `objects.PARENT._relatedLists.LIST.label`, and an entry with none has nothing to translate. One eval case covers both keys. Paid inside each file by cutting restatement; no ceiling of the skills token ratchet moves.
19 changes: 10 additions & 9 deletions skills/objectstack-data/rules/relationships.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,8 @@ InvoiceLine = {

### Detail-page related lists (the read-side mirror)

You usually don't declare the **related list** on the parent's record detail page: every child relationship
is shown **by default** as a tab with its count, a `master_detail` child too. The
On the parent's record detail page every child relationship is a **related list**,
shown **by default** as a tab with its count, a `master_detail` child too. The
relationship flags *refine* that:

```typescript
Expand All @@ -357,22 +357,23 @@ audit_ref: { type: 'master_detail', reference: 'invoice', relatedList: false },
- `relatedList: false` — the child object is not shown on the parent record page.
- `'primary'` — a full-width table in the record's details, with no tab. A parent field
group naming a `master_detail` child (`relatedList: 'quote_line'`, written only when asked)
places its table there too; its tab stays unless a declared `relatedLists` omits it.
- The parent's `relatedLists` is the tab list (objectstack-ui Record Page): absent,
nothing changes; declared, only the named lists show, in order, built-ins by name
places its table there too; its tab stays unless `relatedLists` omits it.
- The parent's `relatedLists` is the tab list (objectstack-ui Record Page): declared,
only the named lists show, in order, built-ins by name
(`sys_attachment`, `sys_approval_request`, `sys_activity`). An entry is the child,
`object.field` or `{ list, label, columns }`. A child in the stack with no inbound FK
`object.field` or `{ list, label, columns }`; its `label` translates at
`objects.{parent}._relatedLists.{list}.label` (none: nothing to translate).
A child in the stack with no inbound FK
is refused everywhere; one that exists nowhere is refused by `os validate` /
`os build` (bar a platform or sibling-artifact name) and by a metadata
write naming no package (one into a package is stored, placing nothing).

`relatedListTitle` / `relatedListColumns` override the derived title / columns
(an entry's `label` / `columns` win); otherwise columns auto-derive from
the child object's `highlightFields`. Audit FKs
(columns: the child's `highlightFields`); an entry's `label` / `columns` win. Audit FKs
(`created_by`/`updated_by`/`owner_id`) never become related lists. A child that
references the parent through several FKs (e.g. `primary_account` +
`partner_account`) yields **one related list per FK**; a self-referential FK
(a hierarchy) surfaces a "children" list.
surfaces a "children" list.

## Incorrect vs Correct

Expand Down
41 changes: 18 additions & 23 deletions skills/objectstack-i18n/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ metadata:

### Stack-Level I18n Config

Configure i18n settings in your `objectstack.config.ts`:

<!-- os:check -->
```typescript
import { defineStack } from '@objectstack/spec';
Expand Down Expand Up @@ -160,11 +158,12 @@ All translatable content for a single object is aggregated under
| Sub-key | Holds |
|:--------|:------|
| `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 |
| `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` (likewise, the title of the related list a `lookup` or `master_detail` field draws on its parent's record page) 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`), `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`) |
| `_relatedLists.{list}` | `label` of an object-form `relatedLists` entry on this (parent) object, by its literal `list` (`event.related_to` is one key); an entry with no `label` has no key and keeps the child field's `relatedListTitle`, else the child's plural label. Spelled `relatedLists`, the group is refused, naming this one |
| `_validations.{rule_name}` | `message` only — the sentence a rejected write returns (replaces the retired `validationMessages`) |
| `_actions.{action_name}.refusals.{CODE}` | `message`, and `reasons.{reason}.message` per declared reason — the sentences of the action's `refusals` catalogue (**objectstack-ui** → Actions), for a code and reason it declares (any other is `translation-target-unknown`); the same under `globalActions.{action_name}` |

Expand All @@ -183,16 +182,21 @@ book once carried stays retired), `mappings` (an import mapping's `label` by its
`datasets.{dataset}.{dimensions,measures}.{member}` (a member's `synonyms` have no key: one
authored list carries every language), and a joined report's block headings sit at
`reports.{report}.blocks.{block_name}.{label,description}`, keyed by the block's required `name`.
Three keys sit deeper than their group's `label`: a `page:tabs` item at
Four keys sit deeper than their group's `label`: a `page:tabs` item at
`pages.{page}.components.{tabs_id}.items.{value}.label` (by the item's `value`; an item without
one has no key), an approval step at `flows.{flow}.approvals.{node_id}.label`, and the text a
one has no key), an approval step at `flows.{flow}.approvals.{node_id}.label`, any other step's
name at `flows.{flow}.nodes.{node_id}.label` (a screen is named by its heading,
`flows.{flow}.screens.{node_id}.title`, and takes a `nodes` key only beside a `title` of its own;
`os i18n check` asks for a flow's top-level steps, and for one of `FLOW_TECHNICAL_NODE_TYPES` —
`script`, `http`, `connector_action`, `assignment`, `boundary_event`, the four `*_record` types —
only where a decision's branch leads to it), and the text a
`create_record` / `update_record` writes into a field marked `{ dialect: 'template', source }` at
`flows.{flow}.records.{node_id}.fields.{field}`. That text, and each sentence a hook or a `script`
action declares in `texts` and writes through `ctx.text` — `hooks.{hook}.texts.{key}.message`,
`_actions.{action_name}.texts.{key}.message` (also under `globalActions`) — is picked in the
organization's language (the Localization setting if set, else `i18n.defaultLocale`; never the caller's).
`os i18n extract --no-objects-only` scaffolds every group above but `messages` and
`settingsCommon`, all three keys included. The `inlineTitle`, report-block, table-column and
`settingsCommon`, all four keys included. The `inlineTitle`, report-block, table-column and
mapping 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):

Expand Down Expand Up @@ -250,13 +254,13 @@ directory tree for you.
|:--|:--|:--|
| Bundled | one `crm.translation.ts` holding every locale | under 5 objects, 2-3 locales |
| Per-locale (recommended) | `src/translations/{en,zh-CN,ja-JP}.ts` + `index.ts` | 5-20 objects, 3-5 locales |
| Per-namespace | `i18n/{locale}/{object}.json`, assembled by your own imports | 20+ objects, 5+ locales |
| Per-namespace | `i18n/{locale}/{object}.json` | 20+ objects, 5+ locales |

---

## Authoring at Runtime: the `translation` Item

Translations do not have to ship as files. A **`translation` metadata item** — created in
A **`translation` metadata item** — created in
the Studio, through the metadata API, or by an agent — carries one locale's worth of the
**same** `objects.*` groups documented above plus the `locale` it translates. `locale` is
required, one locale per item, and published items load at boot and on every publish,
Expand All @@ -271,7 +275,7 @@ exact Zod shape is `TranslationItemSchema` in

### Simple Format (Default)

Both shipped adapters (`FileI18nAdapter` and the in-memory fallback) substitute
Both shipped adapters substitute
**double-brace** `{{variable}}` placeholders only — single braces pass through
unchanged. (The schema docstring mentions `{variable}` notation, but that is not
what the runtime implements.)
Expand All @@ -296,8 +300,6 @@ was removed). To pluralize, select the form in application code before calling `

### `os i18n check`

The working coverage path is the CLI:

```bash
os i18n check # every locale found in the config
os i18n check --locales=zh-CN # scope to specific locales
Expand All @@ -324,15 +326,11 @@ os i18n extract <config> --locales=zh-CN,ja-JP --fill=default \
fails if that differs from what is committed in `--out`, naming each stale or
missing file and printing the regenerate command.

**Use both gates — they answer different questions.** `os i18n check` asks *are
the strings translated?* (coverage: human work). `extract --check` asks *are the
generated bundles still what the schema produces?* (freshness: machine output).
Renaming a label or removing a spec key leaves coverage at 100% while bundles go
stale — how the platform's own ended up translating keys the schema had deleted.
**Use both gates:** renaming a label or removing a spec key leaves coverage at
100% while the bundles go stale.

It runs in the same **merge mode** as a normal extract, so it never asks for
re-translation: an up-to-date bundle re-extracts byte-identically. Requires
`--out` — there is nothing to compare against without it.
re-translation: an up-to-date bundle re-extracts byte-identically. Requires `--out`.

### Diff & Coverage Schemas

Expand Down Expand Up @@ -414,8 +412,6 @@ produced; a client renders it as received.

### 1. Extract Skeletons from Metadata

Scaffold ready-to-edit translation files from your stack config:

```bash
os i18n extract --locales=zh-CN --out=./src/translations
```
Expand All @@ -433,9 +429,8 @@ the rest: `--filter`, `--no-merge`, `--dry-run`, `--json`, …

### 2. 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
more step: a generated module exports an objects *subtree*
A **package or plugin shipping its own generated bundle** has one more step than
`defineStack({ translations: [...] })`: a generated module exports an objects *subtree*
(`NonNullable<TranslationData['objects']>`), not a `TranslationData`, so it must be
wrapped before it is a bundle at all.

Expand Down
10 changes: 10 additions & 0 deletions skills/objectstack-i18n/evals/bundles-locales-coverage.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,16 @@
"must_contain": ["hooks", "lead_follow_up", "texts", "follow_up_subject", "defaultLocale"],
"must_not_contain": ["messages: {", "_hooks"]
}
},
{
"id": 16,
"prompt": "In zh-CN the `crm_account` record page still titles one tab `Meetings`: the object declares `relatedLists: [{ list: 'crm_event.related_to', label: 'Meetings' }, 'crm_contact']`. The manual's drawing of the `opportunity_approval` flow names its `high_value` decision in English too, and `os i18n check` never asks for the flow's `mark_approved` `update_record` step. Which keys do I add, and is the check missing one?",
"expected_output": "`objects.crm_account._relatedLists['crm_event.related_to'].label` on the parent, keyed by the entry's literal `list` as one key; the bare `crm_contact` entry authors no `label`, so it has no key and keeps the child field's `relatedListTitle`, else the child's plural label. `flows.opportunity_approval.nodes.high_value.label` for the decision. The check is not missing one: `update_record` is one of the technical node types, whose `nodes` key it asks for only where a decision's branch leads to the step.",
"files": [],
"assertions": {
"must_contain": ["_relatedLists", "crm_event.related_to", "nodes", "high_value"],
"must_not_contain": ["approvals.high_value", "screens.high_value"]
}
}
]
}
Loading