How do I add a translatable language? - 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.

24-05-2016

How do I add a translatable language?

Introduction

This page explains how to add a translatable language for the content model. To read more about how to add another language for the CMS UI, see Plugin localization.

Add a content translation language to the CMS

Open the Console and browse to:

/hippo:configuration/hippo:frontend/cms/cms-services/localeProviderService 

Copy a child node and name it to the locale you want to add. Change the hippo:language and hippo:message properties of the the  hippo:translation child nodes (one for each of the available CMS languages).

The following countries already have an icon available:

ae, ar, at, au, be, bg, br, ca, ch, cn, cy, cz, de, dk, ee, 
es, fi, fr, gb, gr, hu, id, ie, in, ir, it, jp, kr, lt, lu, 
lv, mt, mx, nl, no, nz, pk, pl, pt, ro, ru, sa, se, sg, si, 
sk, tr, ua,  uk (deprecated: use 'gb' instead), us, za

For example, to add Spanish:

<?xml version="1.0" encoding="UTF-8"?>
<sv:node sv:name="es" xmlns:sv="http://www.jcp.org/jcr/sv/1.0">
 <sv:property sv:name="jcr:primaryType" sv:type="Name">
  <sv:value>frontend:pluginconfig</sv:value>
 </sv:property>
 <sv:property sv:name="jcr:mixinTypes" sv:type="Name">
  <sv:value>hippo:translated</sv:value>
 </sv:property>
 <sv:property sv:name="country" sv:type="String">
  <sv:value>es</sv:value>
 </sv:property>
 <sv:property sv:name="language" sv:type="String">
  <sv:value>es</sv:value>
 </sv:property>
 <sv:node sv:name="hippo:translation">
  <sv:property sv:name="jcr:primaryType" sv:type="Name">
    <sv:value>frontend:pluginconfig</sv:value>
  </sv:property>
  <sv:property sv:name="hippo:language" sv:type="String">
    <sv:value>de</sv:value>
  </sv:property>
  <sv:property sv:name="hippo:message" sv:type="String">
    <sv:value>Spanisch</sv:value>
  </sv:property>
 </sv:node>
 <sv:node sv:name="hippo:translation">
  <sv:property sv:name="jcr:primaryType" sv:type="Name">
    <sv:value>frontend:pluginconfig</sv:value>
  </sv:property>
  <sv:property sv:name="hippo:language" sv:type="String">
    <sv:value>en</sv:value>
  </sv:property>
  <sv:property sv:name="hippo:message" sv:type="String">
    <sv:value>Spanish</sv:value>
  </sv:property>
 </sv:node>
 <sv:node sv:name="hippo:translation">
  <sv:property sv:name="jcr:primaryType" sv:type="Name">
    <sv:value>frontend:pluginconfig</sv:value>
  </sv:property>
  <sv:property sv:name="hippo:language" sv:type="String">
    <sv:value>es</sv:value>
  </sv:property>
  <sv:property sv:name="hippo:message" sv:type="String">
    <sv:value>EspaƱol</sv:value>
  </sv:property>
 </sv:node>
 <sv:node sv:name="hippo:translation">
  <sv:property sv:name="jcr:primaryType" sv:type="Name">
    <sv:value>frontend:pluginconfig</sv:value>
  </sv:property>
  <sv:property sv:name="hippo:language" sv:type="String">
    <sv:value>fr</sv:value>
  </sv:property>
  <sv:property sv:name="hippo:message" sv:type="String">
    <sv:value>Espagnol</sv:value>
  </sv:property>
 </sv:node>
 <sv:node sv:name="hippo:translation">
  <sv:property sv:name="jcr:primaryType" sv:type="Name">
    <sv:value>frontend:pluginconfig</sv:value>
  </sv:property>
  <sv:property sv:name="hippo:language" sv:type="String">
    <sv:value>nl</sv:value>
  </sv:property>
  <sv:property sv:name="hippo:message" sv:type="String">
    <sv:value>Spaans</sv:value>
  </sv:property>
 </sv:node>
</sv:node>

Add a custom set of icons for a language

It is possible to provide custom icons if the standard flag icons are not sufficient, or no flag icon is available out-of-the-box for a certain desired locale.
Note that the 'country' field in the locale provider service configuration does not have to be a real country code. It is merely an identifier used to locate the icons to show in the UI. So the locale icons can also be used to represent something project-specific.

For example, these are the steps to use icons with 'xx' in their names for the 'en' locale:

  1. Change the property country of /hippo:configuration/hippo:frontend/cms/cms-services/localeProviderService/en to xx
  2. Add two icons to the CMS module (one of 11x9 pixels and one of 16x16 pixels):
  • cms/src/main/resources/org/hippoecm/frontend/translation/icons/flags/flag-11x9_xx.png
  • cms/src/main/resources/org/hippoecm/frontend/translation/icons/flags/flag-16_xx.png
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?