feat: add language switching to admin and merchant frontends
Some checks failed
CI / ruff (push) Successful in 10s
CI / pytest (push) Failing after 46m27s
CI / validate (push) Successful in 23s
CI / dependency-scanning (push) Successful in 29s
CI / docs (push) Has been skipped
CI / deploy (push) Has been skipped

- Add cookie to ADMIN resolution chain (cookie → user_pref → "en")
- Add explicit MERCHANT resolution (cookie → user_pref → "fr")
- Add language selector dropdown to admin and merchant headers
- Add languageSelector() function to merchant init-alpine.js
- Add flag-icons CSS and i18n.js setup to merchant base template
- Add compact flag-based language selector to both login pages
- Make lang attribute dynamic on all base and login templates
- Pass current_language to login route template context
- Update architecture doc with ADMIN/MERCHANT resolution priorities

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-24 10:26:57 +01:00
parent 0389294b1a
commit 6c78827c7f
11 changed files with 219 additions and 17 deletions

View File

@@ -57,7 +57,10 @@ async def admin_login_page(
if current_user:
return RedirectResponse(url="/admin/dashboard", status_code=302)
return templates.TemplateResponse("tenancy/admin/login.html", {"request": request})
return templates.TemplateResponse("tenancy/admin/login.html", {
"request": request,
"current_language": getattr(request.state, "language", "en"),
})
@router.get("/select-platform", response_class=HTMLResponse, include_in_schema=False)

View File

@@ -67,7 +67,10 @@ async def merchant_login_page(
if current_user:
return RedirectResponse(url="/merchants/dashboard", status_code=302)
return templates.TemplateResponse("tenancy/merchant/login.html", {"request": request})
return templates.TemplateResponse("tenancy/merchant/login.html", {
"request": request,
"current_language": getattr(request.state, "language", "fr"),
})
# ============================================================================