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
14 changes: 14 additions & 0 deletions .changeset/37988-skills-i18n-packages-group.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
'@objectstack/skills': patch
---

docs(skills): `objectstack-i18n` teaches the bundle's `packages` group, and both related-list skills name the two ways a `.custom` arrangement's tab title is translated

Clause-②: no
Metadata-protocol: none

`skills/objectstack-i18n/SKILL.md`, the top-level group list: `packages` holds a package's display `name` / `description`, keyed by its `manifest.id` with the dotted id as one key (`packages: { 'com.acme.crm': { name: '客户关系' } }`). A locale with no row shows `manifest.name`, and `os lint` warns `i18n/missing-package` (`os i18n check` lists the same gap by key) until that package's own bundle carries the row.

`skills/objectstack-i18n/SKILL.md`, the `_relatedLists.{list}` row, and `skills/objectstack-data/rules/relationships.md`, the `relatedLists` bullet: where the paired `.custom` arrangement leaves a list with no key, the remedy is to drop the key or re-state the entry, shown, with a `label`. The owner's own `label` keeps the owner's translation; a `label` of the arrangement's own is translated at the same `objects.{parent}._relatedLists.{list}.label` key in the `.custom` package's bundle, which `os i18n check` expects.

Nothing an author can write changes. Neither file grows: `objectstack-i18n/SKILL.md` moves down to its measurement (6333 to 6315), the additions paid by replacing the translation-reference paragraph's list of action keys judged against a declaration, each already conditioned in the `_actions` row, with one sentence pointing at that row, and by dropping the code-comment tails that repeat the sentence introducing the first example; `rules/relationships.md` moves down too (4181 to 4179), paid by four restating phrases in the same file.
20 changes: 20 additions & 0 deletions content/docs/protocol/kernel/i18n-standard.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -378,11 +378,23 @@ const zh: TranslationData = {
apps: { crm: { label: '客户关系管理', navigation: { home: { label: '首页' } } } },
dashboards: { sales_overview: { label: '销售概览' } },
pages: { landing: { title: '欢迎' } },
packages: { 'com.acme.crm': { name: '客户关系管理', description: '销售与客户管理' } }, // keyed by manifest.id
globalActions: { export_csv: { label: '导出 CSV' } },
messages: { commonSave: '保存' },
};
```

`packages` is keyed by the package's `manifest.id`, and the dotted id is **one**
key: a client reads the row by direct property access, never as a dot path. A
key that is not a manifest id (a namespace like `crm`, a display name) is
refused at parse, as are `package` and the leaf spellings `label`, `title` and
`displayName`, each answered with the declared spelling. A row overlays the
manifest's own `name` / `description` where the console lists packages (Setup's
package list and Studio's package switcher); a package with no row for the
reader's locale shows its `manifest.name`, which stays the authored value on
every wire and in every editor. Each package ships the row for its own id in
the bundle it already carries.

**Key benefits:**
- ✅ All translatable content for one object in one place
- ✅ CLI can generate translation skeletons per object
Expand Down Expand Up @@ -1221,6 +1233,14 @@ options: { 'Direct Mail': '直邮' } // ❌ keyed by the label — never resolv
options: { 'direct-mail': '直邮' } // ❌ a variant spelling of the value
```

`packages` keys are held to the manifest id grammar at parse and are not
resolved against the artifact's manifests here. Their coverage is a separate
report: `os i18n extract` scaffolds `packages.{id}.name` / `.description` for
the stack's manifest and every composed package. `os lint` reports a missing
one as the warning `i18n/missing-package`, and `os i18n check` lists the same
gap by its key; adding the row to that package's own bundle for the locale
clears both.

`messages`, `settingsCommon` and `metadataForms` are **not** checked: their
keys are owned by application code, plugins, and the platform's own
metadata-type registry rather than by this stack's metadata, so there is no set
Expand Down
14 changes: 14 additions & 0 deletions content/docs/ui/translations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export default defineStack({
| Permission-set label / description | `permissions.<name>.label` / `description` — the group is spelled as the stack spells the collection (`permissions[]`), keyed by the set's `name` |
| Doc book title, description and section titles | `books.<name>.label` / `description` / `groups.<key>.label` — keyed by the book's `name` and each group's `key`; overlaid on every served book and on the book tree, which is what the docs sidebar draws. A doc's own title and body localize through `doc.translations` instead |
| Import mapping label | `mappings.<name>.label` — keyed by the mapping's `name`; overlaid on every served mapping, which is the list the import wizard offers by name. A mapping's `fieldMapping` holds column and field names, not copy: a target field's label is translated under `objects.<object>.fields.<field>.label` |
| Package name / description | `packages.<manifest id>.name` / `description` — keyed by the package's `manifest.id` (reverse-domain, such as `com.acme.crm`; the dotted id is one key), never by its namespace or display name, which the parse refuses. Overlaid where the console lists packages: Setup's package list and Studio's package switcher, where a package that publishes an app is still named by the app's label. With no row for the reader's locale, a package shows its `manifest.name`. Each package ships the row for its own id in its own bundle |
| Global actions, messages | `globalActions`, `messages` |
| Settings UI shell copy (the source badge on a settings row) | `settingsCommon.sourceLabels.<layer>` — the per-namespace settings copy under `settings` is **platform-only**: an app bundle carrying it is refused by name, and the platform's own strings are translated in `@objectstack/service-settings`'s bundle |
| A label written as an inline locale map (`label: { en: 'Members', 'zh-CN': '成员' }`) | Nowhere — it is written on the metadata and resolved at render time; see **Current boundaries** below |
Expand Down Expand Up @@ -360,6 +361,19 @@ A missing string in the **default** locale is an error; missing strings in
other locales are warnings until you set `--strict` / `--threshold`. The Todo
example ships a completeness test alongside its bundles — worth copying.

A package's own display name is part of that report. `os i18n extract` scaffolds
`packages.<manifest id>.name` / `.description` for the stack's manifest and
every composed package. `os lint` reports a missing one as the warning
`i18n/missing-package`, and `os i18n check` lists the same gap by its key
(`packages.com.acme.crm.name`). Clear it by adding the row to that package's
own bundle for the locale; the source locale needs one only when the displayed
name should differ from `manifest.name`:

```typescript
// one locale of the package's own bundle (zh-CN)
packages: { 'com.acme.crm': { name: '客户关系管理', description: '销售与客户管理' } },
```

### What counts as *your* coverage

The Studio's own metadata forms (`metadataForms.*` — several hundred keys
Expand Down
24 changes: 22 additions & 2 deletions scripts/check-skills-token-ratchet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,19 @@ export const CEILINGS = new Map([
// the retired action location word `list_item` (-7 bytes); the row follows the measurement
// down, 24384 bytes (24357 priced) -> 24377 (24350 priced) -> 6088 tokens.
['skills/objectstack-formula/SKILL.md', 6088], // -53 (was 6055), then -5 A2′ (was 6002), then +11 (was 5997), then +82 (was 6008), then -2 (was 6090)
['skills/objectstack-i18n/SKILL.md', 6333], // -11 (was 6349), then -5 A2′ (was 6338)
// 6333 -> 6315: the top-level group list gains `packages` (`name` / `description` by
// `manifest.id`, the `os lint` warning `i18n/missing-package` and what clears it), and the
// `_relatedLists` row's remedy names both routes under a `.custom` arrangement (the owner's
// `label`, or the arrangement's own, read from the `.custom` package's bundle). Paid in full
// by deleting restatement in this file: the translation-reference paragraph's list of action
// keys judged against a declaration, each already conditioned in the `_actions` row (now one
// sentence pointing at that row, which gains "non-empty" on `submitText`), and the
// first example's three code-comment tails ("one TranslationData per locale", "assemble the
// locales into one bundle…", "…and register it on the stack"), which repeat the sentence
// introducing that example. No raise, no ruling spent:
// 25359 bytes (25332 priced) -> 25285 (25258 priced); the row follows the measurement down.
// ceil(($(wc -c < skills/objectstack-i18n/SKILL.md) - 27) / 4) == ceil(25258 / 4)
['skills/objectstack-i18n/SKILL.md', 6315], // -11 (was 6349), then -5 A2′ (was 6338), then -18 (was 6333)
// 12705 -> 12984 (2026-08-31 app-repo-principles raise, see the block above).
// The largest of the five and the frame the other four are read under: what an
// app IS (metadata under the platform's spec, authored from these skills,
Expand Down Expand Up @@ -1381,7 +1393,15 @@ export const CEILINGS = new Map([
// 4201 -> 4181: the roll-up visibility paragraph no longer asks to remove Modify All before
// masking a summary (19: it overrides no mask). 16801 -> 16723 bytes.
// ceil($(wc -c < skills/objectstack-data/rules/relationships.md) / 4) == ceil(16723 / 4)
['skills/objectstack-data/rules/relationships.md', 4181], // -2 to the measurement (was 4203)
// 4181 -> 4179: the `relatedLists` bullet's remedy under a `.custom` arrangement names the
// arrangement's own `label` beside the owner's (translated in the `.custom` package's
// bundle). Paid by deleting restatement in this file: "(cascade delete)" in the type table
// (the Delete Behaviors section states it), "to aggregate" after the roll-up intro, and the
// grid example's "(a field group names invoice_line, as above)", and "places the lines and"
// in the inline-entry example's comment (the prose above it says so). 16724 -> 16714 bytes;
// the row follows the measurement down.
// ceil($(wc -c < skills/objectstack-data/rules/relationships.md) / 4) == ceil(16714 / 4)
['skills/objectstack-data/rules/relationships.md', 4179], // -2 to the measurement (was 4203), then -2 (was 4181)
// NEW FILE (#14296 item 1 = A, condition (b)): the entry's Security & Access
// Control block moved here whole. Pinned at its landed count — no headroom,
// because a split that arrives with budget is a raise wearing a new path.
Expand Down
11 changes: 6 additions & 5 deletions skills/objectstack-data/rules/relationships.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
| Type | Lifecycle | Required | Sharing | Roll-ups | Use Case |
|:-----|:----------|:---------|:--------|:---------|:---------|
| `lookup` | Independent | Optional by default | Independent | Via `summary` | "Related to" |
| `master_detail` | Coupled (cascade delete) | Forced only under `controlled_by_parent`, unless the optional master (below); else lint-warned | Inherits parent; read-on-master opt-ins (below) | Via `summary` | "Owned by" |
| `master_detail` | Coupled | Forced only under `controlled_by_parent`, unless the optional master (below); else lint-warned | Inherits parent; read-on-master opt-ins (below) | Via `summary` | "Owned by" |
| `tree` | Self-reference | Optional — and so is `reference`, which when written must name this object itself; any other object is refused at parse, not lint-warned | N/A | Not available | Hierarchical |

## Patterns
Expand Down Expand Up @@ -188,7 +188,7 @@ transaction.
}
```

`object` is the child object to aggregate, `field` its field (ignored for
`object` is the child object, `field` its field (ignored for
`count`), `function` one of `count` / `sum` / `min` / `max` / `avg`. Optional:
`filter` (below) and `relationshipField` (omitted: the child's `lookup` /
`master_detail` referencing this parent). Refused at publish when omitted and the
Expand Down Expand Up @@ -254,7 +254,7 @@ and parent + children save in **one atomic transaction**. A parent or child
declaring `enable.apiMethods` must list `'bulk'`, or that save is refused `405 OBJECT_API_METHOD_NOT_ALLOWED`.

```typescript
// PARENT `invoice`: the group places the lines and holds no fields
// PARENT `invoice`: the group holds no fields
fieldGroups: [{ key: 'lines', label: 'Line Items', relatedList: 'invoice_line' }],

// CHILD `invoice_line`: its master_detail FK, declaring no `relatedList`
Expand Down Expand Up @@ -289,7 +289,7 @@ editable fields, else `grid`.
**Modeling a `'grid'` line item for the full editor:**

```typescript
// Parent (a field group names invoice_line, as above)
// Parent
Invoice = {
fields: {
tax_rate: Field.number({ label: 'Tax Rate (%)' }), // → live Subtotal/Tax/Total stack
Expand Down Expand Up @@ -360,7 +360,8 @@ audit_ref: { type: 'master_detail', reference: 'invoice', relatedList: false },
arrangement re-stating the entry with no `label`, or hiding it, leaves none (a
bare child's name, labelled or not, covers each of its `child.field` lists too) and
`os validate` refuses the key: drop it, or re-state the entry, shown, with the
owner's `label`. A child in the stack with no inbound FK
owner's `label`, or the arrangement's own, translated at that key in the `.custom`
package's bundle. 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).
Expand Down
Loading
Loading