fix(i18n): relabel metadata UI on language switch without refresh (#1319)#1418
Merged
Conversation
) Renderers cache server-resolved metadata labels (object/field/view labels, action-dialog text) by object name and never refetch on a language change, so a switch left the UI half-translated until a hard refresh. - auth: fold the active <html lang> into Accept-Language on API calls so the server resolves metadata in the new locale (never clobbers an explicit header) - app-shell: ConnectedShellInner clears the adapter's locale-blind metadata cache in the render phase and remounts the metadata subtree via key={language} so every renderer refetches; the adapter/connection are preserved (in-app relabel, not a reconnect) - i18n: dev-mode missing-key warnings (createI18n warnMissingKeys, deduped handler) that stay silent for useObjectLabel's intentional convention probes Renderer half of #1319; pairs with the framework-side locale-aware metadata.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
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.
What
Renderer half of objectstack-ai/framework#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, list headers, action-dialog text) stayed in the old language until a hard refresh.
Root cause: renderers fetch those labels into state keyed by object name and never refetch on a language change, and the adapter's metadata cache is locale-blind.
Changes
@object-ui/auth—createAuthenticatedFetchfolds the active<html lang>intoAccept-Languageon/api/calls (never clobbering an explicit header), so a switch carries the new locale on every subsequent request.@object-ui/app-shell—ConnectedShellInnerdrops the adapter's locale-blind metadata cache in the render phase (before children refetch) and remounts the metadata subtree viakey={language}, so every renderer refetches in the new locale. The adapter and its live connection sit above the key and are preserved — an in-app relabel, not a reconnect (auth/session/URL persist).@object-ui/i18n— dev-mode missing-key warnings:createI18ngainswarnMissingKeys(default on outside production) wiring a deduped i18nextmissingKeyHandler.useObjectLabel's convention-key probes are flagged (I18N_PROBE_FLAG) so their intentional misses — which fall back to server metadata — stay silent.Why two moves in app-shell
Child effects flush before parent effects, so an effect-based cache clear would race the remounted children's fetch effects and serve a stale entry. Clearing in render guarantees it precedes the refetch.
Testing
packages/auth— newcreateAuthenticatedFetch.test.tsx(7 tests): token/tenant/Accept-Languageon API calls, empty-lang and non-API skips, never clobbers an explicit header.packages/i18n—i18n.test.ts+5: warn-once, dedupe, no-warn-on-resolved, silent for flagged probes, disabled-mode.Notes for reviewers
origin/main; single commit, chore: release packages #1319 only. The unrelated view-inspector/studio work stays onfix/view-inspector-config-shape.@objectstack/clientfrom the registry, so this fix is decoupled from the unpublished frameworksetLocaleand lives at the fetch-wrapper level.i18n/authminor,app-shellpatch).