Uh oh!
There was an error while loading. Please reload this page.
fix(i18n): metadata labels follow language switch without refresh (#1319) - #1391
Conversation
#1319) Server-resolved metadata labels (object/field/view labels, action-dialog text) were fetched-and-cached per locale and never refetched on a language switch, leaving the UI half-translated until a hard refresh. - client: add setLocale/getLocale and send Accept-Language on every request - objectql/spec: make the protocol ETag locale-aware so cached metadata does not collide across languages - client-react: refetch metadata hooks when the active locale changes - rest: honor the request locale when resolving metadata labels - apps/account: thread the router locale so a switch relabels in place Closes#1319 (framework half; the objectui renderer half ships separately).
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Uh oh!
There was an error while loading. Please reload this page.
xuyushun441-sys
commented
May 30, 2026
Re: failing Vercel check ( |
What
Resolves the framework half of #1319: switching the UI language (zh-CN ↔ English) left the app half-translated — static strings flipped instantly but server-resolved metadata labels (object/field/view labels, action-dialog text) stayed in the old language until a hard refresh.
Root cause: metadata labels are resolved server-side and cached per fetch, with no locale awareness in the request or the protocol ETag, so a language switch never refetched them.
Changes
@objectstack/client— addsetLocale/getLocale; sendAccept-Languageon every request so the server resolves labels in the active locale.@objectstack/objectql+@objectstack/spec— make the protocol ETag locale-aware so cached metadata no longer collides across languages.@objectstack/client-react— metadata hooks refetch when the active locale changes (ObjectStackLocaleContext, render-phasesetLocalesync).@objectstack/rest— honor the request locale when resolving metadata labels.apps/account— thread the router locale through__root.tsxso a language switch relabels in place.Why this matters
This is the platform half of a two-repo fix. The companion renderer change ships in objectui (
createAuthenticatedFetchAccept-Language injection + a render-phase cache clear andkey={language}metadata-subtree remount), because objectui consumes@objectstack/clientfrom the registry and can't depend on the unpublishedsetLocale. Together they satisfy the issue's acceptance criterion: switch language without a page refresh.Testing
packages/client—client.test.tscoverssetLocale/getLocale+Accept-Languageheader.packages/objectql—protocol-meta.test.tscovers the locale-aware ETag.Notes for reviewers
origin/main; the PR contains a single commit. Unrelated in-progress seed-loader/system-names work in the working tree was deliberately left out.client/client-reactminor;objectql/rest/specpatch).