DeepTutor
DeepTutor copied to clipboard
fix: bootstrap persisted interface language on first load
Summary
- expose a lightweight
GET /api/v1/settings/uiendpoint for app-shell bootstrap - load the persisted interface language in the Next.js root layout before SSR and inject it into
<html lang>andAppShellProvider - create an isolated, synchronously initialized i18n instance per provider so the first server render already uses the persisted language
- fall back to the browser cache only when the backend language cannot be loaded
- treat the backend default
New conversationtitle as a placeholder rather than user content - add the missing composer translations surfaced by hard-refresh testing
Root cause
The settings page and the global app shell used different language sources. Settings loaded data/user/settings/interface.json, while the app shell initialized to English and only reconciled the persisted language after hydration. That produced an English SSR first paint before the client switched to Chinese.
User impact
Fresh visits and hard refreshes now render directly in the persisted interface language. The page no longer flashes English before switching to Chinese, real user/generated session titles remain unchanged, and the existing English/local-cache fallbacks still work.
Validation
pnpm --dir web run test:node— 367 passeduv run pytest tests/api/test_settings_router.py -k 'ui_settings'— 3 passedpnpm --dir web run i18n:check— locale parity OK (the audit reports 27 pre-existing literal candidates)pnpm --dir web build— production build passedgit diff --check- browser hard refresh on
/home/unified_1785463218522_9d2ba686:<html lang="zh">- Chinese navigation, session placeholder, composer placeholder, file/persona/voice controls
- real session title
111preserved - no
New conversation,Add files & context,Select persona, orRecord voice
- raw server HTML contains
主页,设置,新对话, and你想学点什么?before hydration
Fixes #729