title: spring i18n LocaleResolver getLocale
body: <p>dealing with spring i18n. I have defined two beans in <code>spring-mvc.xml</code></p>
  
  <pre><code>&lt;bean name="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"&gt;
      &lt;property name="paramName" value="lang" /&gt;
  &lt;/bean&gt;
  
  &lt;bean name="localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver"&gt;
      &lt;property name="defaultLocale" value="en" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>and two anchors in jsp to switch languages</p>
  
  <pre><code>&lt;span&gt;
      &lt;a href="?lang=en"&gt;english&lt;/a&gt;
      | 
      &lt;ahref="?lang=zh"&gt;chinese&lt;/a&gt;
  &lt;/span&gt;
  </code></pre>
  
  <p>I tried to get the parameter <code>lang/locale</code> at my controller and i18n the results before javascripts <em>(because I want to i18n java script)</em>, but doesn't work.</p>
  
  <pre><code>request.getLocale().getDisplayName();
  request.getParameter("lang");
  </code></pre>
  
  <p>how do I get the <code>Locale</code> at my controller? or any good idea to i18n java scripts?</p>
  
  <p>Thanks in advance!</p>