Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Simply include a parameter in the request, either from a link or a form, that sets the requst_locale parameter to the language and (optionally) counry code to use.

Code Block
<h3>Language Options</h3>
<ul>
     <li><html:link action="/Locale?language=en">English</html:link><<li>
        <s:url id="en" action="Welcome">
            <s:param name="request_locale">en</s:param>
        </s:url>
        <s:a href="%{en}">English</s:a>
    </li>
    <li><html:link<li>
        <a href="<s:url action="/Locale?language=ja" useLocalEncoding="true">Welcome">
            <s:param name="request_locale">ja</s:param>
        Japanese<</html:link><s:url>">Japanese</a>
   </li>
    <li><html:link action="/Locale?language=ru" useLocalEncoding="true">
<li>
        <a href="<s:url value="Welcome.do">
            <s:param name="request_locale" value="'ru'" />
          Russian<  </html:link><s:url>">Russian</a>
    </li>
</ul>

The default interceptor stack includes an i18n interceptor that watches for the request_locale parameter. The parameter name is configurable.

An alternative is to set the locale by calling the setLocale method of ActionSupport.