UI Plugin Localization

Bloomreach Content uses statically compiled resource bundles to provide translations for the CMS user interface and plugins. Common use cases include:

  • Translating configuration for custom HST components and channel information
  • Translating configuration for custom Targeting collectors

Statically compiled resource bundles are one method for localizing the CMS UI. For additional localization options, see CMS UI localization.

There are two types of compile-time translations:

  • Java property files, used by Wicket code
  • JSON files, used by Angular code with Angular Translate

The following section explains how to use Java property files for localization in Wicket.

Using Java Resource Bundles in Wicket

Wicket plugins in Bloomreach Content use a combination of Java class files and HTML files with matching names. To localize UI text, add .properties files with the same base filename. For each supported language, append an underscore and the language code to the filename. The default language file does not include a language code. For example:

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

Properties and HTML files with the same name can exist in the classes folder of the WAR file. These files take precedence over files located in JARs inside the WAR. For example, the DashboardPerspective plugin includes the following files:

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

To define a translatable message in the HTML file, use the Wicket message tag. For example, to define a message with the key todo:

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

The content inside the <wicket:message> tag (todo message) is the default value. The corresponding .properties files specify the localized text to display instead. The default language is English, so DashboardPerspective.properties contains:

todo: My todo list

The Dutch translation in DashboardPerspective_nl.properties is:

todo: Dingen die ik moet doen

At runtime, Wicket replaces the content of the <wicket:message> tag with the value from the appropriate properties file based on the user's language. If no properties file is present for a given language, the default content (todo message) is used.

Share Feedback
Page: /build/plugins/core-plugins/plugin-localization
Section: Build
Category *
UI Plugin Localization | Bloomreach Content Documentation