You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7a55ba4
Browse filesBrowse the repository at this point in the historyBrowse files
fix(i18n): carry the hooks translation group through its exhaustive copies
The console's translation preview and loader group list, the i18n docs, the
walk-parity fixture and the served hook property count move with the new
group. Hook refusal pins read the declared code off declaredCode.
Claude-Session: https://claude.ai/code/session_01WGufzfyVQuRsL6SRGuKCem
Co-authored-by: Claude <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: .changeset/26170-hook-refusal-catalogue.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ feat(spec): a hook declares its refusal catalogue, and its body refuses by code,
11
11
Clause-②: yes (widening)
12
12
Metadata-protocol: added
13
13
14
-
A hook can now declare `refusals`: one entry per SCREAMING_SNAKE code, each with the `message` the user reads and an optional 4xx `status` (default `400`). A sandboxed `body` then refuses by code only: it throws an error carrying a declared `code`, and the body runner answers with the entry. The message is translated through `hooks.<hook>.refusals.<CODE>.message` in the caller's locale, the code reaches the caller's error envelope, and the status is the entry's. The body's own error text and `status` are not what the caller reads.
14
+
A hook can now declare `refusals`: one entry per SCREAMING_SNAKE code, each with the `message` the user reads and an optional 4xx `status` (default `400`). A sandboxed `body` then refuses by code only: it throws an error carrying a declared `code`, and the body runner answers with the entry. The message is translated through `hooks.<hook>.refusals.<CODE>.message` in the caller's locale, the code reaches the caller's error envelope as `declaredCode` (beside the status's registered `code`), and the status is the entry's. The body's own error text and `status` are not what the caller reads.
15
15
16
16
-**Spec.**`HookSchema.refusals` (`HookRefusalSchema`: `message`, `status?`). A new `hooks` group on the translation bundle, `hooks.<hook>.refusals.<CODE>.message`, and `hookRefusalMessageKey`. `HookContext.session.locale` declares the caller's locale.
17
17
-**Undeclared codes are refused loudly.** A code the body throws literally (`{ code: 'X' }`, or `e.code = 'X'; throw e`) that the catalogue does not declare fails the save at `body.source`. Any other undeclared code, and a throw with no code, is a `500` fault at run time that names the hook and the code. This applies only to a hook that declares `refusals`; a hook without one is answered exactly as before.
`metadataForms`, `settingsCommon`. A group invented beside them
411
411
(`"account"`, `"fields"`, `"list"`, `"industries"`) is rejected **by name**
412
412
at both authoring doors, with the group to use instead named in the
413
413
rejection.
@@ -496,7 +496,7 @@ what the overlay writes back as the node's `title`.
496
496
The contract is `t(key, locale, params?)` — the target locale is always passed
497
497
explicitly, and the key itself is returned when no translation is found (there
498
498
is no `defaultValue` option). The key is a **dot path into `TranslationData`**,
499
-
so it starts at one of the fourteen declared groups.
499
+
so it starts at one of the fifteen declared groups.
500
500
501
501
```typescript
502
502
const i18n =kernel.getService('i18n');
@@ -1077,6 +1077,8 @@ beneath an action entry are judged the same way under either.
1077
1077
|`positions.{name}`| a position's `name`, declared, or an audience anchor (`everyone`, `guest`) |
1078
1078
|`permissions.{name}`| a permission set's `name`, declared |
1079
1079
|`reports.{name}`| a report's `name`, declared |
1080
+
|`hooks.{hook}`| a hook's `name`, declared |
1081
+
|`hooks.{hook}.refusals.{code}`| a code that hook's `refusals` declares |
1080
1082
|`flows.{flow}.screens.{node}`| the `id` of a `type: 'screen'` node in that flow, nodes nested in loop, parallel and try/catch regions included |
1081
1083
|`flows.{flow}.screens.{node}.fields.{field}`| a `config.fields[].name` on that screen — an object-form screen (`config.objectName`) declares none, and its input labels live under `objects.{objectName}.fields`|
Copy file name to clipboardExpand all lines: content/docs/ui/translations.mdx
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,6 +87,7 @@ export default defineStack({
87
87
| Page component copy, by component id |`pages.<name>.components.<id>.title` / `description` / `label` / `placeholder` / `emptyText` — reached under `regions[].components[]` and `slots.<slot>`, through `properties.children` and a `page:tabs` / `page:accordion` panel's `items[].children`|
88
88
| Page tab labels (`page:tabs` items) |`pages.<name>.components.<tabsId>.items.<value>.label` — keyed by the tabs component's `id` and the item's `value`; an item without a `value` has no key (localize it with an inline locale map), and `page:accordion` panels have none |
89
89
| Screen-flow wizards (flow label, screen headings and body text, screen field copy) |`flows.<flow>.label` / `flows.<flow>.screens.<node_id>.title` / `.description` / `.fields.<field>.label` / `.placeholder` / `.inlineHelpText` — a screen field's help text is `inlineHelpText`, the key the field itself declares, not `help`; see the boundary note below |
90
+
| Hook refusal messages |`hooks.<hook>.refusals.<CODE>.message` — one per entry of the hook's `refusals` catalogue. A sandboxed hook body refuses by code, and the server answers the refusal with this message in the caller's locale, else the declared `message`|
90
91
| Position label / description |`positions.<name>.label` / `description` — keyed by the position's `name`; overlaid on every served position, which is the list the console's position picker draws |
91
92
| 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`|
92
93
| Global actions, messages |`globalActions`, `messages`|
0 commit comments