You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IIRC this has been done consciously, but at a point in time where the feature was not fully opt-in yet.
So I personally don't see any blocker for changing this. PR welcome
…are no enabled locales (MatTheCat)
This PR was squashed before being merged into the 6.2 branch.
Discussion
----------
[HttpKernel] Use Accept-Language header even if there are no enabled locales
| Q | A
| ------------- | ---
| Branch? | 6.2
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | Fix#47355
| License | MIT
| Doc PR | N/A
Don’t really know how I should consider this PR 🤔
It would affect people setting `set_locale_from_accept_language` to `true` with no `enabled_locales` when the request has a preferred language:
- before: set the default locale as request locale
- after: set the preferred language as request locale
Commits
-------
b20d074 [HttpKernel] Use Accept-Language header even if there are no enabled locales
Symfony version(s) affected
5.4.11
Description
https://symfony.com/doc/5.4/reference/configuration/framework.html#enabled-locales states that "empty array = enable all locales", but if I set an empty array then set_locale_from_accept_language will not set the locale. I have to fill
enabled_locales
for it to work.Here is the code doing this:
symfony/src/Symfony/Component/HttpKernel/EventListener/LocaleListener.php
Line 71 in e1581a0
$this->enabledLocales
is checked to be non-empty)@chalasr is this logic on purpose? Or does the documentation need adjustment that empty means no locale is enabled?
How to reproduce
Run the following I guess:
symfony/src/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php
Line 172 in 123b165
which tests that no locale is set if
enabled_locales
isn't setPossible Solution
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: