Closed
Description
Symfony version(s) affected
7.1.*
Description
#52986 changed the way, the Accept-Language
header is interpreted.
However, I'm not sure the exact match is always what you want.
Given I have the locales ['de', 'en']
available and I send Accept-Language: de-de, en
, I would now get en
as the result because en
is an exact match. Previously it was de
which imho was the better choice. Any German dialect would be better than English in this case. Even if I'd adjust factor weighting Accept-Language: de-de,en;q=0.9
, Symfony would still pick en
.
Are we sure this is the desired behavior?
/cc @Spomky
How to reproduce
The test in RequestTest::providePreferredLanguage()
would be this:
yield '"de" is selected as "de-de" is a better choice than "en"' => ['de', 'de-de, en', ['de', 'en']];
Possible Solution
No response
Additional Context
No response