[HttpKernel] Use Accept-Language header even if there are no enabled locales#47377
Conversation
|
Can you add a test case that breaks before your patch? |
cea51ed to
0d61b4a
Compare
|
@chalasr done. While updating |
c20d409 to
0a81366
Compare
89c118d to
8a39eeb
Compare
|
@MatTheCat Can you create a PR on 4.4 for the tests fix? |
8a39eeb to
8c596ad
Compare
8c596ad to
59a0229
Compare
…ers (MatTheCat) This PR was merged into the 5.4 branch. Discussion ---------- [HttpKernel] Fix LocaleListenerTest Accept-Language headers | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix symfony/symfony#47377 (comment) | License | MIT | Doc PR | N/A Commits ------- b6ac197fa4 Fix LocaleListenerTest Accept-Language headers
59a0229 to
21c1347
Compare
|
Damn okay sorry 😅 PR rebased! |
|
No worries, I'd say it should be improved on Github :) |
WDYT? Don’t really know how to make it shorter. |
|
Works for me! |
b38ef33 to
fde7667
Compare
fde7667 to
7869325
Compare
7869325 to
b20d074
Compare
|
Thank you @MatTheCat. |
|
I'm a bit late here but this means we are going to always send the Vary: Accept-Language header, isn't it? I'm not sure this is legit. |
|
@nicolas-grekas only if |
|
Oh, thanks. Two other issues: why on 6.2 and not on 6.1? And more importantly: the vary header should also be sent when $preferredLanguage is falsy. The code should look like this: } elseif ($this->useAcceptLanguageHeader) {
if ($preferredLanguage = $request->getPreferredLanguage($this->enabledLocales)) {
$request->setLocale($preferredLanguage);
}
$request->attributes->set('_vary_by_language', true);
}Can you please send a PR on 6.1 if you agree? |
|
I’m not sure about you two questions 😞 so I’ll wait for the approval of other members before submitting another PR. |
|
Nicolas is right, please go ahead if you want/can. |
…no enabled locales (MatTheCat) This PR was squashed before being merged into the 6.1 branch. Discussion ---------- [HttpKernel] Use Accept-Language header even if there are no enabled locales | Q | A | ------------- | --- | Branch? | 6.1 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #47377 | License | MIT | Doc PR | N/A Commits ------- d97d51c [HttpKernel] Use Accept-Language header even if there are no enabled locales
Don’t really know how I should consider this PR 🤔
It would affect people setting
set_locale_from_accept_languagetotruewith noenabled_localeswhen the request has a preferred language: