#23813: Fix UI locale persistence
app: web-ui
agents
size: XS
Cluster:
Multilingual Support Enhancements
## Summary
- *Problem:* The UI language setting was not being applied upon initial page load, even if a non-English language was stored in localStorage.
- *Why it matters:* It caused a confusing user experience where the language dropdown showed one language (e.g., Chinese) while the entire interface remained in English until manually toggled.
- *What changed:* Added a call to `this.notify()` at the end of the `loadLocale()` method in the `I18nManager` class. This ensures that all UI subscribers are informed of the correct locale immediately during the initialization phase.
- *What did NOT change:* No changes were made to the translation files (`locales/*`) or the actual translation logic (`t` function).
## Change Type
- [x] Bug fix
- [ ] Feature
- [ ] Refactor
- [ ] Docs
- [ ] Security hardening
- [ ] Chore/infra
## Scope
- [ ] Gateway / orchestration
- [ ] Integrations
- [ ] API / contracts
- [x] UI / DX
- [ ] CI/CD / infra
## Linked Issue/PR
- Closes #23784
## User-visible / Behavior Changes
The UI will now correctly display in the user's preferred (saved) language immediately upon opening the dashboard.
## Security Impact
- New permissions/capabilities? (`No`)
- Secrets/tokens handling changed? (`No`)
- New/changed network calls? (`No`)
- Command/tool execution surface changed? (`No`)
- Data access scope changed? (`No`)
## Repro + Verification
### Environment
- OS: Any (Web Browser)
- Runtime/container: Browser
- Model/provider: N/A
- Integration/channel: Control UI (i18n subsystem)
### Steps
1. Open the Control UI and change the language to "简体中文" (Simplified Chinese).
2. Refresh the page.
3. Observe the UI language before the fix (remains English despite dropdown showing Chinese).
4. Apply fix and repeat.
### Expected
- The UI should translate to Chinese immediately on load.
### Actual
- The UI stayed in English until the language was manually changed again.
## Evidence
- Verified by inspection of the `I18nManager` subscriber pattern.
- Ran `pnpm build` to ensure UI builds correctly with the change.
## Human Verification
- *Verified scenarios:* Initial load with English, initial load with Chinese (via localStorage).
- *Edge cases checked:* Fallback to navigator language when localStorage is empty.
- *What you did not verify:* Behaviour in legacy browsers without `localStorage` support.
## Compatibility / Migration
- Backward compatible? (`Yes`)
- Config/env changes? (`No`)
- Migration needed? (`No`)
## Failure Recovery
- How to disable/revert this change quickly: Revert the added line in `ui/src/i18n/lib/translate.ts`.
- Files/config to restore: `ui/src/i18n/lib/translate.ts`.
## Risks and Mitigations
- *Risk:* Minor performance hit during initialization if there are thousands of subscribers.
- *Mitigation:* Currently, subscribers are limited to core UI components; the notification is instantaneous.
Most Similar PRs
#23241: feat(ui): add Simplified Chinese (zh-CN) i18n support for Dashboard
by SidQin-cyber · 2026-02-22
76.1%
#23792: fix(i18n): trigger UI re-render on page load by calling notify() in...
by oom2018 · 2026-02-22
74.7%
#21619: fix(i18n): load saved locale translations on page refresh
by zerone0x · 2026-02-20
72.8%
#22165: feat(i18n): translate hardcoded button labels to all 4 locales
by NikolaVujovic1988 · 2026-02-20
70.8%
#13622: feat(i18n): add complete multi-language support (EN, TR, FR, DE)
by vaur94 · 2026-02-10
70.0%
#10657: feat(ui): add i18n support with English, Chinese, and Portuguese
by SalimBinYousuf1 · 2026-02-06
68.1%
#19881: feat(i18n): add Japanese (ja) locale for Control UI [AI-assisted]
by habakan · 2026-02-18
67.7%
#21617: feat(i18n): added korean locale
by Jaejuna · 2026-02-20
67.3%
#20498: UI: modularize control UI architecture and normalize spacing.
by MAGE-VOID · 2026-02-19
66.3%
#22570: feat(i18n): add Korean (ko) locale to Control UI
by hoonsikim · 2026-02-21
64.4%