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
AcceptHeaderLocaleResolver should allow to define a default Locale [SPR-14312] #18884
It would be cool if AcceptHeaderLocaleResolver would allow configuring a default Locale just as CookieLocaleResolver does. The use case is that I'd like to allow clients to explicit request a certain local but at the same time make sure that a well-defined default is used, independently of the system language (to prevent different deployment locations from changing the default).
It looks like we'd have to check whether the Accept-Language header is set explicitly to find out whether to use the configured default in the first place.
The current implementation does not fallback to default locale if the client-requested locale is not supported.
Consider this (currently failing) test case:
Activity
spring-projects-issues commentedon May 27, 2016
Rossen Stoyanchev commented
Oops, Juergen I didn't see you assigned that one already. I had chatted with Ollie about it just before.
spring-projects-issues commentedon May 27, 2016
Juergen Hoeller commented
No worries, I'm happy for it to be picked up for 4.3 GA still. Assigning it to you for the time being :-)
spring-projects-issues commentedon Apr 10, 2017
Tadas Krivickas commented
The current implementation does not fallback to default locale if the client-requested locale is not supported.
Consider this (currently failing) test case:
Shouldn't default locale be used as a fallback?
https://github.com/spring-projects/spring-framework/blob/master/spring-webmvc/src/main/java/org/springframework/web/servlet/i18n/AcceptHeaderLocaleResolver.java#L100
Related: #17915
spring-projects-issues commentedon Apr 10, 2017
Juergen Hoeller commented
Good point! I've created #19987 to track such a revision.