Skip to content

Commit e7ac53b

Browse files
committed
docs(spec): resolveMetadataFormLabels' docblock states the label-slug section lookup
The docblock said a section without a stable `name` is returned unchanged for section-level attributes. `translateSection` does otherwise: with no `name` it looks the section up under a slug of its string `label`, and only a section with neither keeps its section-level text. Fields are translated either way. The docblock ships in `dist/system/index.d.ts`, so the changeset gains one sentence. Comment only: no code, no `.describe()`. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RD4nZChNGxRzyyWJtvZ8NJ
1 parent 58c3d60 commit e7ac53b

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

‎.changeset/23756-section-translation-tsdoc.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
Clause-②: no
66

7-
The published TSDoc now sends a form section's translations to the right key. `FormSectionSchema.name` used to name only `metadataForms.<type>.sections.<name>`, which is the key for a metadata-editing form (`defineForm({ schemaId })`, read by `resolveMetadataFormLabels`). A section of an object-bound form view is keyed at `objects.<object>._sections.<name>`, where `<object>` is the form's own `data.object`, else its view's. The docblock now names both keys and which form each one serves. `TranslationDataSchema._sections` now names the three surfaces that author its key (form-view sections, `record:details` sections, object `fieldGroups`) and its readers (`walkObjectSections`, `collectViewRecord`, `translateView`). These are comment changes only: no key, `.describe()` text or behaviour changes. An object-form translation bundle written from the old docblock under `metadataForms.…` never translated anything. Move its section entries to `objects.<object>._sections.<name>`.
7+
The published TSDoc now sends a form section's translations to the right key. `FormSectionSchema.name` used to name only `metadataForms.<type>.sections.<name>`, which is the key for a metadata-editing form (`defineForm({ schemaId })`, read by `resolveMetadataFormLabels`). A section of an object-bound form view is keyed at `objects.<object>._sections.<name>`, where `<object>` is the form's own `data.object`, else its view's. The docblock now names both keys and which form each one serves. `TranslationDataSchema._sections` now names the three surfaces that author its key (form-view sections, `record:details` sections, object `fieldGroups`) and its readers (`walkObjectSections`, `collectViewRecord`, `translateView`). `resolveMetadataFormLabels`' docblock no longer says that a section without a `name` keeps its section-level text: such a section is looked up under a slug of its `label`, as the function has always done. These are comment changes only: no key, `.describe()` text or behaviour changes. An object-form translation bundle written from the old docblock under `metadataForms.…` never translated anything. Move its section entries to `objects.<object>._sections.<name>`.

‎packages/spec/src/system/i18n-resolver.ts‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3916,9 +3916,13 @@ function translateFormField(
39163916
* Translate the labels, descriptions, helpTexts, and placeholders of a
39173917
* metadata-type configuration form against the active translation bundle.
39183918
*
3919-
* Sections without a stable `name` are returned unchanged for section-level
3920-
* attributes — only field labels are translated (field names are always
3921-
* stable identifiers).
3919+
* A section's `label` and `description` are looked up at
3920+
* `metadataForms.<type>.sections.<section_name>`, where `<section_name>` is
3921+
* the section's own `name` or, when it has none, a slug of its string `label`
3922+
* (lowercased, `&` → `and`, each run of non-alphanumerics → `_`, edge
3923+
* underscores trimmed). Only a section with neither keeps its section-level
3924+
* text. Its fields are translated either way, since field names are always
3925+
* stable identifiers.
39223926
*
39233927
* Returns a new form object; the input is not mutated.
39243928
*

0 commit comments

Comments
 (0)