Note that there are some explanatory texts on larger screens.

plurals
  1. POlocaleChangeInterceptor does not work
    text
    copied!<p>I have very standard configuration, I kept editing many times, checked other questions on SO but by my final configuration most people had their issues resolved, however no result for me. Whenever firing requests like: </p> <p><code>http://localhost:8080/appName/?lang=es_MX</code> </p> <p>or </p> <p><code>http://localhost:8080/appName?lang=es_MX</code> it does not resolve to correct locale, it does just do nothing.</p> <pre><code>&lt;bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"&gt; &lt;property name="basename" value="/WEB-INF/messages" /&gt; &lt;/bean&gt; &lt;bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver"&gt;&lt;/bean&gt; &lt;mvc:interceptors&gt; &lt;bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"&gt; &lt;property name="paramName" value="lang" /&gt; &lt;/bean&gt; &lt;/mvc:interceptors&gt; </code></pre> <p>I know that default locale resolver by headers work so is my messageResource and .jsp configuration is correct, since I set up one browser explicitly to have es_MX locale and it resolves with AcceptHeaderLocaleResolver correctly.</p> <p>Does it have to do with the way my handler mappings are defined?</p> <pre><code>@RequestMapping(value = "/", method = RequestMethod.GET) public String home( Model model, Locale locale, HttpServletRequest hr) { String header = hr.getHeader("User-Agent"); model.addAttribute("header", header); String contextPath = hr.getContextPath(); model.addAttribute("contextPath", contextPath); return "index"; } </code></pre> <p>God I spent so much time on this...please help</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload