feat: server-side language preference — survives clear site data
Problem: language preference stored only in localStorage, lost on 'clear site data'. French users with browser lang=fr always got French UI even when profile was English. Solution: - Backend: add 'language' field to user profile (default 'fr') - Backend: PATCH /api/auth/me to update language preference - Frontend: initI18n() priority: server > localStorage > navigator > 'fr' - Frontend: initAuth() runs before initI18n() so server check works - Frontend: profile Save persists language to server via PATCH Verified: tabs show English after server profile set to 'en'
This commit is contained in:
+6
-3
@@ -23,7 +23,12 @@ import { initMermaid, setupFocusMode } from './mermaid-viewer.js';
|
||||
// Initialization — mirrors the original app.js init() ordering
|
||||
// =========================================================================
|
||||
async function init() {
|
||||
await initI18n(); // Must run before any rendering that uses t()
|
||||
// 1. Init auth first — needed for server-side language preference
|
||||
const authOk = await Auth.AuthManager.initAuth();
|
||||
|
||||
// 2. Init i18n after auth so server language preference is available
|
||||
await initI18n();
|
||||
|
||||
UI.initTheme();
|
||||
UI.initHeaderMenu();
|
||||
UI.initCustomDropdowns();
|
||||
@@ -54,8 +59,6 @@ async function init() {
|
||||
initCommandPalette();
|
||||
initMobileToolbar();
|
||||
|
||||
const authOk = await Auth.AuthManager.initAuth();
|
||||
|
||||
if (authOk) {
|
||||
Legacy.initSyncStatus();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user