Skip to content

Commit 2443bb4

Browse files
os-helpclaude
andauthored
fix(rest): localize the canonical PLURAL /meta spelling, not just the singular (#6349) (#7372)
`translateMetaItem` / `translateMetaItems` decide whether a metadata type is localizable by asking `isTranslatableMetaType`, which reads `TRANSLATABLE_METADATA_TYPES` — a set DERIVED (#3786) from `METADATA_DOCUMENT_TRANSLATORS`' keys, and those keys are singular-only (view / action / object / app / dashboard / page), matching `translateMetadataDocument`'s documented "Canonical metadata type string". The three `/meta` read handlers handed those helpers the RAW `:type` path segment. Prime Directive #3 makes PLURAL the canonical REST spelling, so a caller following the documentation missed the set, the predicate answered false, and the whole localization was skipped — same route, same document, same Accept-Language, two different answers. Normalized in the two helpers (the issue's option 2) rather than at the five call sites, for the reason #6241 proved: a normalization the callers own is one a later caller forgets. `metaTypeSingular` leaves an unmapped type untouched, so the translatable SET is unchanged — only the spellings that reach it. Claude-Session: https://claude.ai/code/session_0158ZQo7LiHSxGWpYKuPq1wu Co-authored-by: Claude <noreply@anthropic.com>
1 parent 121852d commit 2443bb4

3 files changed

Lines changed: 438 additions & 4 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
'@objectstack/rest': patch
3+
---
4+
5+
`/meta` reads localize the canonical PLURAL spelling, not just the singular
6+
7+
The three metadata read handlers (`GET /meta/:type`, `GET /meta/:type/:name`,
8+
`GET /meta/:type/:section/:name`) handed the raw `:type` path segment to the
9+
translate helpers, whose "does this type translate" predicate reads a set derived
10+
from singular-only translator keys (`view` / `action` / `object` / `app` /
11+
`dashboard` / `page`). Prime Directive #3 makes plural the canonical REST
12+
spelling, so a caller following the documentation received unlocalized
13+
labels/descriptions/navigation while the singular spelling of the same route
14+
returned the translated document.
15+
16+
`translateMetaItem` / `translateMetaItems` now fold the spelling to the canonical
17+
singular before asking, so both spellings answer the same localized body. The set
18+
of translatable types is unchanged — only which spellings reach it.

0 commit comments

Comments
 (0)