Delivery Tier I18N support

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

To use I18N support in Hippo's delivery tier (HST), take the following steps:

To the site/webapp/src/main/webapp/WEB-INF/web.xml, add:

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

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

messages_en_US.properties

home.title=Home

messages_nl_NL.properties

home.title=Thuis

Using the Console, add the default locale to the virtual hosts configuration, for example:

/hst:myproject/hst:hosts:
  /hst:locale: en_US

Optionally, you can configurge a different locale on a specific mount, for example:

/hst:myproject/hst:hosts/dev-localhost/localhost/hst:root/nl:
  /hst:locale: nl_NL

In your frontend templates, you can now use the fmt:message tag without first setting the locale, as this is automatically set by the deliver tier based on the configuration. For example:

JSP

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

Freemarker

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

Do 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?