fix(#225): honor Accept-Language q-values in backend locale resolver #264

Merged
integrator-bot merged 1 commits from dev/issue-225-backend-i18n-resolver-qweight into main 2026-03-02 04:05:38 +01:00
Owner

Summary

  • rank Accept-Language candidates by q-value before selecting supported locale
  • keep existing fallback behavior (en) when no supported candidate is provided
  • update i18n resolver test to assert highest-quality supported locale wins

Testing

  • .venv/bin/python manage.py test lobby.tests.I18nResolverTests lobby.tests.LobbyFlowTests.test_join_error_localizes_to_danish_with_accept_language_header lobby.tests.LobbyFlowTests.test_join_error_falls_back_to_english_for_unsupported_locale

Refs #225

## Summary - rank `Accept-Language` candidates by q-value before selecting supported locale - keep existing fallback behavior (`en`) when no supported candidate is provided - update i18n resolver test to assert highest-quality supported locale wins ## Testing - `.venv/bin/python manage.py test lobby.tests.I18nResolverTests lobby.tests.LobbyFlowTests.test_join_error_localizes_to_danish_with_accept_language_header lobby.tests.LobbyFlowTests.test_join_error_falls_back_to_english_for_unsupported_locale` Refs #225
dev-bot added 1 commit 2026-03-02 04:01:35 +01:00
fix(i18n): honor Accept-Language q-values in locale resolver (#225)
All checks were successful
CI / test-and-quality (push) Successful in 3m6s
CI / test-and-quality (pull_request) Successful in 3m17s
aa2d636e90
reviewer-bot approved these changes 2026-03-02 04:04:09 +01:00
Dismissed
reviewer-bot left a comment
Owner

WPP review (isolated):

  • Scope/Regression: Backend resolve_locale now ranks supported Accept-Language candidates by q-value and preserves stable tie-break by header order. This fixes prior first-match behavior and aligns with RFC intent.
  • Security: No auth/input-sanitization regression seen; parsing remains bounded/simple and ignores q<=0 as expected.
  • Testdækning: Existing i18n resolver tests were updated with a focused case for highest-quality preference.
  • i18n: Behavior now correctly prefers the highest-priority supported locale (da;q=0.8, en;q=0.9 => en).
  • Repo-hygiejne: Change set is minimal and targeted.

Validation note: Local frontend targeted tests pass in this runner; Django test execution is not available in this runtime due missing Django env, so backend verification here is by code+test diff inspection (CI should enforce full backend suite).

Result: APPROVED.

WPP review (isolated): - Scope/Regression: Backend `resolve_locale` now ranks supported Accept-Language candidates by q-value and preserves stable tie-break by header order. This fixes prior first-match behavior and aligns with RFC intent. - Security: No auth/input-sanitization regression seen; parsing remains bounded/simple and ignores q<=0 as expected. - Testdækning: Existing i18n resolver tests were updated with a focused case for highest-quality preference. - i18n: Behavior now correctly prefers the highest-priority supported locale (`da;q=0.8, en;q=0.9` => `en`). - Repo-hygiejne: Change set is minimal and targeted. Validation note: Local frontend targeted tests pass in this runner; Django test execution is not available in this runtime due missing Django env, so backend verification here is by code+test diff inspection (CI should enforce full backend suite). Result: APPROVED.
reviewer-bot approved these changes 2026-03-02 04:04:44 +01:00
Dismissed
reviewer-bot left a comment
Owner

API probe for official state

API probe for official state
reviewer-bot approved these changes 2026-03-02 04:04:53 +01:00
reviewer-bot left a comment
Owner

WPP review (isolated): regressions/sikkerhed/test/i18n/repo-hygiejne gennemgået. Backend locale resolver rangerer nu korrekt på q-values med stabil tie-break på header-rækkefølge. Ingen sikkerhedsregression fundet. Testcase for højeste kvalitet er tilføjet. APPROVED.

WPP review (isolated): regressions/sikkerhed/test/i18n/repo-hygiejne gennemgået. Backend locale resolver rangerer nu korrekt på q-values med stabil tie-break på header-rækkefølge. Ingen sikkerhedsregression fundet. Testcase for højeste kvalitet er tilføjet. APPROVED.
integrator-bot merged commit 7c7a6b6a08 into main 2026-03-02 04:05:38 +01:00
integrator-bot deleted branch dev/issue-225-backend-i18n-resolver-qweight 2026-03-02 04:05:38 +01:00
Sign in to join this conversation.