From 3f0e680446458b04cfc79a054da2ecd3ed516d71 Mon Sep 17 00:00:00 2001 From: Claude Code Date: Wed, 13 May 2026 21:14:56 +0000 Subject: [PATCH] feat(frontend): Light-i18n + Org-Sprache durch /auth/me Backend: - UserMeResponse um output_language (de | en) erweitert. - /auth/me liefert die Org-Sprache aus organization_settings. Frontend: - Neu: static/js/i18n.js mit T(key)-Helper, I18N.load(lang) und applyDom() ueber data-i18n + data-i18n-attr. - Neu: static/i18n/de.json + en.json (sichtbare Bereiche: Sidebar, Header, Modal-Titel, Faktencheck-Status, Refresh-Hinweise). - dashboard.html: i18n.js Script-Tag vor api.js, data-i18n auf den prominenten Strings (Abmelden, + Neuer Fall, Alle/Eigene, Sidebar- Sektionen, Bericht exportieren, Faktencheck-Tab, Lage anlegen). Tutorial.init() entfernt aus DOMContentLoaded. - components.js: factCheckLabels/Tooltips/ChipLabels als Getter ueber T() mit DE-Fallbacks. - app.js: vor Setup wird I18N.load(user.output_language) aufgerufen und applyDom() ausgefuehrt. Tutorial.init() laeuft nur bei lang === de. Phase 6 von 8 (eng_demo / Org-Sprache). --- src/models.py | 1 + src/routers/auth.py | 7 ++++ src/static/dashboard.html | 25 ++++++------- src/static/i18n/de.json | 64 +++++++++++++++++++++++++++++++++ src/static/i18n/en.json | 64 +++++++++++++++++++++++++++++++++ src/static/js/app.js | 17 +++++++++ src/static/js/components.js | 39 +++++++++++++++++--- src/static/js/i18n.js | 71 +++++++++++++++++++++++++++++++++++++ 8 files changed, 271 insertions(+), 17 deletions(-) create mode 100644 src/static/i18n/de.json create mode 100644 src/static/i18n/en.json create mode 100644 src/static/js/i18n.js diff --git a/src/models.py b/src/models.py index 2a8b38d..6f9dc71 100644 --- a/src/models.py +++ b/src/models.py @@ -43,6 +43,7 @@ class UserMeResponse(BaseModel): credits_remaining: Optional[int] = None credits_percent_used: Optional[float] = None is_global_admin: bool = False + output_language: str = "de" # Incidents (Lagen) diff --git a/src/routers/auth.py b/src/routers/auth.py index 968b690..420b815 100644 --- a/src/routers/auth.py +++ b/src/routers/auth.py @@ -216,6 +216,12 @@ async def get_me( if _staging_mode(): is_global_admin_response = False + # Org-Sprache fuer Frontend-i18n + output_language_iso = "de" + if current_user.get("tenant_id"): + from services.org_settings import get_org_language + output_language_iso = await get_org_language(db, current_user["tenant_id"]) + return UserMeResponse( id=current_user["id"], username=current_user["username"], @@ -233,6 +239,7 @@ async def get_me( read_only_reason=license_info.get("read_only_reason"), unlimited_budget=unlimited_budget, is_global_admin=is_global_admin_response, + output_language=output_language_iso, ) diff --git a/src/static/dashboard.html b/src/static/dashboard.html index 311f659..1ce0473 100644 --- a/src/static/dashboard.html +++ b/src/static/dashboard.html @@ -80,25 +80,25 @@
- +