Description
Oliver Becker opened SPR-16457 and commented
We are using the AcceptHeaderLocaleResolver
along with a list of supported language locales to determine a matching locale based on the browser's accepted locales. This works pretty well for most browsers as those browsers always send also the (base) language locale as accepted locale.
For example if I configure Chrome to use "German (Germany)" as the preferred language, it will send both "de-DE" and "de" as accepted locales.
Unfortunately this is not the case in iOS where the request contains only a single "de-DE" locale. Currently the AcceptHeaderLocaleResolver
will not accept "de-DE" if only "de" is in the list of supported locales, so it will fallback to the default locale.
I could work around this limitation by either creating a list of all possible country locales for our supported language locales or by modifying the HTTP request to strip the country part from the accepted locales.
It would be great if I don't have to do this and the AcceptHeaderLocaleResolver
would match automatically a country specific locale against a supported language locale.
Affects: 4.3.14
Issue Links:
- Revise AcceptHeaderLocaleResolver default locale handling [SPR-15426] #19987 Revise AcceptHeaderLocaleResolver default locale handling
- Invalid/missing locale strings in header prevents resolving the locale [SPR-16500] #21043 Invalid/missing locale strings in header prevents resolving the locale
- AcceptHeaderLocaleResolver chooses wrong Locale for language match [SPR-16599] #21140 AcceptHeaderLocaleResolver chooses wrong Locale for language match
Referenced from: commits cd8a1bd, 4dc9645, 8fda96c
Backported to: 4.3.15