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

@@ -73,6 +73,7 @@ class LanguageMiddleware(BaseHTTPMiddleware):
language = resolve_store_dashboard_language(
user_preferred=user_preferred,
store_dashboard=store_dashboard,
cookie_language=cookie_language,
)
elif frontend_type == FrontendType.STOREFRONT:
@@ -170,6 +171,7 @@ def set_language_cookie(response: Response, language: str) -> Response:
max_age=60 * 60 * 24 * 365, # 1 year
httponly=False, # Accessible to JavaScript
samesite="lax",
path="/",
)
return response
@@ -184,5 +186,5 @@ def delete_language_cookie(response: Response) -> Response:
Returns:
Modified response with cookie deleted
"""
response.delete_cookie(key=LANGUAGE_COOKIE_NAME)
response.delete_cookie(key=LANGUAGE_COOKIE_NAME, path="/")
return response