Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BCP 47 compatible Locale support [SPR-13274] #17865

Closed
spring-projects-issues opened this issue Jul 24, 2015 · 2 comments
Closed

BCP 47 compatible Locale support [SPR-13274] #17865

spring-projects-issues opened this issue Jul 24, 2015 · 2 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Jul 24, 2015

Mike Noordermeer opened SPR-13274 and commented

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?


Affects: 4.2 RC3

Issue Links:

Referenced from: commits 4668aa7

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

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...

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

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.

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants