UI Plugin Localization - 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.

12-05-2015

UI Plugin Localization

For localization, Hippo CMS uses the standard  Wicket method of .properties files and in addition hippo:translation nodes in the  hippo:configuration and  hippo:namespaces trees in the repository. For both the properties files and the translation nodes, translations in a particular language have to be supplied.

Wicket property files

In Wicket you use a combination of a Java class file and an HTML file of the same name. For localization one can also add .properties files. In Hippo CMS these files all have an underscore and a language code at the end of the filename, except for the default language. For example:

addon/cms/dashboard/src/main/java/org/hippoecm/frontend/plugins/cms/dashboard
   DashboardPerspective.java
   DashboardPerspective.html
   DashboardPerspective.properties
   DashboardPerspective_nl.properties

In the Hippo CMS 7, there can be .properties files and or the HTML files of the same name in the WAR, which are found before the other files. For the DashboardPerspective the following files are used:

WEB-INF/default/org/hippoecm/frontend/plugins/cms/dashboard
   DashboardPerspective.html
   DashboardPerspective.properties
   DashboardPerspective_nl.properties

In the html file, you can define Wicket messages. For example a message with key 'todo':

<wicket:message key="todo">todo message</wicket:message>

Here the content of the Wicket message is 'todo message'. The .properties files define what should be inserted instead of the content, in this example instead of 'todo message'. The default language is English so the DashboardPerspective.properties file contains the English property definition:

todo: My todo list

While the DashboardPerspective_nl.properties contains the Dutch property definition:

todo: Dingen die ik moet doen

The string 'My todo list' or the string 'Dingen die ik moet doen' replaces in the HTML file the content of the wicket:message element with key 'todo'. So the string 'todo message' is replaced. Without any properties files, the string 'todo message' would be used.

Translation nodes

New   hippo:translation nodes for an extra language can be imported via a    hippoecm-extension.xml. Import an  hippo:translation node to all occurrences of sets of   hippo:translation nodes (in the   hippo:configuration and  hippo:namespaces trees). During import the tree should be merged and the   hippo:translation nodes should be added.

Note that you can use several   hippoecm-extension.xml files in your project and in dependencies, so you can make one in your language Jar.

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?