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
{{ message }}
Repository navigation
BCP 47 compatible Locale support [SPR-13274] #17865
Currently, the Spring localehandling (i.e., LocaleChangeInterceptor and LocaleResolver) only support language tags in the legacy pre-Java 7 format (e.g., nl_NL). Nowadays BCP 47 language tags 1 are the recommended approach 2, but none of the Spring supplied classes accept the new format.
I think it should be fairly easy to support both formats (simply replacing some underscores with dashes should bring you a long way), and am willing to provide a PR once we agree on which classes should be changed and whether BCP 47 should be opt-in or not. What are your thoughts on this?
The key places where this is beneficial seem to be LocaleChangeInterceptor and CookieLocaleResolver specifically. For internal bean configuration purposes within the application, it's usually better to provide the Locale object to begin with... String variants are only really meant to be used for very simple purposes there (even just for the language, no country spec to begin with).
I've got this working already, to appear in a 4.3 snapshot soon...
LocaleChangeInterceptor and CookieLocaleResolver support individual "languageTagCompliant" configuration properties now, controlling whether the request parameter value and the cookie-contained locale representation should follow the BCP 47 language tag format, respectively.
Activity
spring-projects-issues commentedon Dec 21, 2015
Juergen Hoeller commented
The key places where this is beneficial seem to be
LocaleChangeInterceptorandCookieLocaleResolverspecifically. For internal bean configuration purposes within the application, it's usually better to provide theLocaleobject to begin with... String variants are only really meant to be used for very simple purposes there (even just for the language, no country spec to begin with).I've got this working already, to appear in a 4.3 snapshot soon...
Juergen
spring-projects-issues commentedon Dec 21, 2015
Juergen Hoeller commented
LocaleChangeInterceptorandCookieLocaleResolversupport individual "languageTagCompliant" configuration properties now, controlling whether the request parameter value and the cookie-contained locale representation should follow the BCP 47 language tag format, respectively.Juergen