AW: Wrong fallback language

Sobotka Martin martin.sobotka at inet-logistics.com
Wed May 31 03:08:50 EDT 2017


> I haven't reviewed the Spring MVC docs in awhile on this, but their LocaleResolver impls usually take a 'defaultLocale' property which sets the default if it is otherwise unspecified.  You can even see this in one of our examples (expand the 2nd one):
> 
> https://wiki.shibboleth.net/confluence/display/IDP30/Switching+locale+on+the+login+page

Thanks for the hint. The CookieLocaleResolver takes the property "defaultLocale". I tried this in the past with default values like "en" or "en-US" without success - fallback is still German.


> They don't really mention this in the Spring Framework locale docs [1],  so might be helpful to look at the actual Javadocs for the various concrete LocaleResolver impl classes, which are mostly linked from here [2].  Looks like the AcceptHeader-, Cookie- and Session- ones all do, either directly in the impl or via the abstract base class AbstractLocaleResolver.

> [1] http://docs.spring.io/spring/docs/4.3.7.RELEASE/spring-framework-reference/html/mvc.html#mvc-localeresolver
> [2] http://docs.spring.io/spring/docs/4.3.7.RELEASE/javadoc-api/org/springframework/web/servlet/LocaleResolver.html

I'll take a look on the real implementations.

Best Regards,
Martin




More information about the users mailing list