Can I set a default country for SpringLocalizationContext?
A few days ago I noticed that the <fmt:formatNumber> JSTL tag doesn't behave as expected in our application. It would always format a decimal number using , instead of . as "fraction delimiter" i.e. 69,00 instead of 69.00. I tried with <fmt:setLocale value="de_CH"/> but strangely this didn't seem to make a difference at all.
Today I tracked it down to o.s.w.servlet.support.JstlUtils$SpringLocalization Context providing a locale without country when asked through getLocale()*. So, the language is set properly but the country is "". When formatting numbers I assume the language to be much less relevant than the country...
The MVC config says
If I change defaultLocale to de_CH everything works fine. However, this means that I could never invoke the LocaleChangeInterceptor, which is currently configured like this
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
<property name="defaultLocale" value="de"/>
passing only language information i.e. I would always have to pass a complete Locale string. Since our application only supports the three Swiss locales (de_CH, fr_CH, it_CH) I was wondering whether I could somehow set a default country?
<bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="lang" />
* org.apache.taglibs.standard.tag.common.fmt.BundleS upport.getLocalizationContext(PageContext) asks the page context for an object named javax.servlet.jsp.jstl.fmt.localizationContext. This object is an instance of JstlUtils$SpringLocalizationContext.