Delivery Tier I18N support - BloomReach Experience - Open Source CMS

This article covers a Hippo CMS version 10. There's an updated version available that covers our most recent release.

27-05-2015

Delivery Tier I18N support

If you want dynamic I18N support maintenable via the CMS, you should use Dynamic Resource Bundles.  

 

I18N support in the Hippo's delivery tier (HST) is very simple. Take the following steps:

To the web.xml add:

  <!-- I18N  -->
  <context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>messages</param-value>
  </context-param>

To your src/main/resources add the I18N bundles, for example:

messages_en_US.properties

home.title=Home

messages_nl_NL.properties

home.title=Thuis

To the ' hst:hosts' add the default locale, for example:

<sv:property sv:name="hst:locale" sv:type="String">
     <sv:value>en_US</sv:value>
</sv:property>

and to the Mounts that should have a different locale add the hst:locale as well, For example:

<sv:node sv:name="nl">
  <sv:property sv:name="jcr:primaryType" sv:type="Name">
     <sv:value>hst:mount</sv:value>
  </sv:property>
      <sv:property sv:name="hst:locale" sv:type="String">
   <sv:value>nl_NL</sv:value>
  </sv:property>
</sv:node>

Now, in your templates you can use fmt:message tag without first setting the locale. This is done by the HST already. For example:

JSP

<fmt:message key="home.title"/>

Freemarker

<@fmt.message key="home.title"/>

Note that you thus should not use <fmt:setLocale value="some_locale" scope="page | request | session | application"/>. An exception is for rss feeds, as these always need the locale 'en-US' : <fmt:setLocale value="en-US"/>

Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?