Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You must have an interceptor in applicationContext like </p> <pre class="lang-xml prettyprint-override"><code>&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>You also need </p> <pre class="lang-xml prettyprint-override"><code>&lt;bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"&gt; &lt;property name="basename" value="classpath:messages" /&gt; &lt;property name="defaultEncoding" value="UTF-8" /&gt; &lt;/bean&gt; &lt;bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver"/&gt; </code></pre> <p>On the first JSP page of my project I gave a choice for languages like that:</p> <pre class="lang-html prettyprint-override"><code>&lt;span style="float: right"&gt; &lt;a href="?lang=en"&gt;en&lt;/a&gt; | &lt;a href="?lang=fr"&gt;fr&lt;/a&gt; &lt;/span&gt; </code></pre> <p>Please tell me if this helped you.</p> <p>P.S. My messages_*.properties files are in a source folder src/main/resources, not in webapp, I don't know if this matters.</p> <p>P.P.S. Useful tutorial here: <a href="http://springbyexample.org/examples/basic-webapp-internationalization.html" rel="nofollow">http://springbyexample.org/examples/basic-webapp-internationalization.html</a></p> <p>I would like to add also that at the beginning of your xml you should have stuff like:</p> <pre class="lang-xml prettyprint-override"><code>&lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util" xmlns:security="http://www.springframework.org/schema/security" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd"&gt; </code></pre> <p>It is necessary in order to recognize the prefixes such as mvc. Make sure you have it.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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