-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Closed
Description
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:
} elseif ($this->useAcceptLanguageHeader && $this->enabledLocales && ($preferredLanguage = $request->getPreferredLanguage($this->enabledLocales))) { |
$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
public function testRequestNoLocaleFromAcceptLanguageHeader() |
which tests that no locale is set if enabled_locales
isn't set
Possible Solution
No response
Additional Context
No response