fix: language switcher stuck in French on store dashboard
Some checks failed
CI / ruff (push) Successful in 11s
CI / pytest (push) Failing after 44m35s
CI / validate (push) Successful in 23s
CI / dependency-scanning (push) Successful in 28s
CI / docs (push) Has been skipped
CI / deploy (push) Has been skipped

Three compounding bugs prevented language switching on the store dashboard:
- Cookie missing path="/", scoping it to the API endpoint path only
- STORE frontend resolution chain ignored the cookie entirely
- Store header used inline x-data with wrong language names instead of shared languageSelector()

Also updates architecture doc with correct per-frontend resolution priorities,
cookie name, API endpoint path, and file references.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-24 05:30:25 +01:00
parent cd935988c4
commit 0389294b1a
4 changed files with 35 additions and 51 deletions

View File

@@ -351,15 +351,20 @@ def get_jinja2_globals(language: str = None) -> dict:
def resolve_store_dashboard_language(
user_preferred: str | None,
store_dashboard: str | None,
cookie_language: str | None = None,
) -> str:
"""
Resolve language for store dashboard.
Priority:
1. User's preferred_language (if set)
2. Store's dashboard_language
3. System default (fr)
1. Cookie (explicit UI action via language switcher)
2. User's preferred_language (DB preference from profile settings)
3. Store's dashboard_language
4. System default (fr)
"""
if cookie_language and cookie_language in SUPPORTED_LANGUAGES:
return cookie_language
if user_preferred and user_preferred in SUPPORTED_LANGUAGES:
return user_preferred