fix(i18n): translate Setup System Settings menu labels and pages#1670
Merged
Conversation
The Setup app's Configuration menu gained Authentication, File Storage, AI & Embedder, and Knowledge entries, but their nav labels were never added to the translation bundles, and several settings pages had no localized content. Untranslated locales fell back to the raw English literal (or key). Setup nav menu labels (platform-objects): - Add nav_settings_storage / nav_settings_ai / nav_settings_knowledge to en, zh-CN, ja-JP, es-ES. - Add the missing nav_settings_auth label to zh-CN, ja-JP, es-ES. Settings page content (service-settings): - Add the auth page to zh-CN, ja-JP, es-ES. - Add the ai and knowledge pages to ja-JP. en remains the source of truth; keys mirror the manifest field names.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The single-item app route bypasses the HTTP cache (for per-user RBAC
filtering), so it received the raw `getMetaItem` envelope
`{ type, name, item, ... }` and passed it straight to
`translateMetadataDocument`. Because the translatable document — and
its `navigation` tree — lives nested at `.item`, the resolver found no
`navigation` to walk and left every Setup menu label in English; only
the envelope's own top-level label got translated, which consumers
reading `.item` never see.
Add `isMetaEnvelope` and unwrap the inner document before translating in
both `translateMetaItem` and `translateMetaItems`. Also handle the
`{ items: [...] }` list-envelope shape in `translateMetaItems`, which the
bare `Array.isArray` guard previously dropped untranslated.
…ons)
The Setup app left four nav labels in English because no bundle key
existed for them across any locale:
- group_integrations (the empty integrations anchor owned by the
Setup app itself; only the singular group_integration for Studio
was translated)
- nav_notification_{preferences,subscriptions,templates} (contributed
to group_configuration by @objectstack/service-messaging, which
ships no translation bundle)
These merge into the Setup app by stable node id, so their labels
belong in the central SetupAppTranslations alongside nav_notifications.
Add all four to en, zh-CN, ja-JP and es-ES.
Cover the regression directly: a getMetaItem envelope must have its
nested .item translated (not the envelope top level), the bare
already-unwrapped document path must still work, and both list shapes
({items:[...]} and a raw array) must localize their elements.
Contributor
Author
|
Scope note: while verifying this PR I found that the System Settings pages ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Setup app ("System Settings") rendered most of its left-nav menu in
English even for
zh-CN/ja-JP/es-ESusers. Investigation foundtwo independent causes — a missing-data gap and a structural bug at
the REST translation boundary.
1. Root cause —
getMetaItemenvelope was never unwrapped before translationGET /meta/app/setupfor the single-item app route bypasses the HTTPcache by design (per-user RBAC filtering via
filterAppForUser), so itreceived the raw
getMetaItemenvelope{ type, name, item, lock, … }and passed the whole envelope to
translateMetadataDocument. But thetranslatable document — and its
navigationtree — lives nested at.item. The resolver found nonavigationon the envelope's top level,so it walked nothing and left every menu label in English; only the
envelope's own top-level
labelgot translated, which consumers reading.itemnever see.The cached read path passes the already-unwrapped document, so it was
never affected — which is exactly why the bug only showed on the
cache-bypassing app route.
A parallel bug: list endpoints (
{ items: [...] }shape) were droppeduntranslated by a bare
Array.isArray(items)guard.2. Missing translation keys
Several Setup nav entries had no bundle key in any locale, so they
fell back to English regardless of the above:
nav_settings_auth/storage/ai/knowledge/feature_flagsgroup_integrations(the Setup app's own empty integrations anchor)nav_notification_{preferences,subscriptions,templates}(contributed togroup_configurationby@objectstack/service-messaging, which shipsno translation bundle)
auth/ai/knowledge) missingfor some locales.
Changes
packages/rest/src/rest-server.ts— the structural fixisMetaEnvelope()and unwrap the inner document before callingtranslateMetadataDocumentin bothtranslateMetaItemandtranslateMetaItems.translateMetaItemsnow also handles the{ items: [...] }list-envelopeshape (previously dropped untranslated).
packages/rest/src/rest.test.ts— 4 regression tests covering envelopeunwrap, the bare-document path, and both list shapes (
{items}+ raw array).packages/platform-objects/src/apps/translations/{en,zh-CN,ja-JP,es-ES}.ts— Setup nav menu labels:
nav_settings_auth/storage/ai/knowledge/feature_flags,group_integrations, andnav_notification_{preferences,subscriptions,templates}.packages/services/service-settings/src/translations/{zh-CN,ja-JP,es-ES}.ts— settings page content for
auth(+ai/knowledgeforja-JP).enstays the source of truth; all keys mirror the manifest/nav-node namesso the locale → fallback → literal resolver chain stays intact.
Verification
End-to-end against a running dev server (
zh-CN):GET /api/v1/meta/app/setupwithAccept-Language: zh-CN:item.label→ 系统设置, and 0 remaining English nav labels acrossthe whole tree (every group + leaf, including the
type:'url'settingsitems and the notification entries).
全部设置 · 品牌 · 认证 · 邮件 · 文件存储 · AI 与 Embedder · 知识库 ·
功能开关 · 通知偏好 · 通知订阅 · 通知模板.
@objectstack/rest100/100 pass (96 existing + 4 newregression cases).
@objectstack/platform-objectsbuilds clean.Scope / follow-ups
en,zh-CN,ja-JP,es-ES).SetupAppTranslations(alongsidenav_notifications) since they mergeinto the Setup app by stable id. If
@objectstack/service-messaginglater grows its own translation bundle, they could move there.