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 CMS UI 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 country and language properties to reflect the locale you want to add. Display strings for the locales are generated using the standard Java functionality of java.util.Locale#getDisplayLanguage(java.util.Locale).
On Hippo 11.2.0, you can override the display string for the locale by adding the property caption to the node representing the locale
On Hippo 11.2.1 and up, you can override the default display string for the locale by adding subnodes of type frontend:pluginconfig per UI language, with the properties hippo:language matching the locale's language and hippo:message for the display string. For example, if there already is a node ./en for US English, having "English" as default display string, you can override the ./en-gb subnode's display string as follows:
/en-gb: jcr:primaryType: frontend:pluginconfig country: gb language: en /translation-en: jcr:primaryType: frontend:pluginconfig hippo:language: en hippo:message: UK English /translation-nl: jcr:primaryType: frontend:pluginconfig hippo:language: nl hippo:message: Brits Engels
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. 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
Note that the "country" property 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:
- Change the property country of /hippo:configuration/hippo:frontend/cms/cms-services/localeProviderService/en to xx
- Add three icons to the CMS module of your project: a flag of 11x9 pixels, one of 16x16 pixels and a flag with a plus sign 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
- cms/src/main/resources/org/hippoecm/frontend/translation/icons/plus/flag-plus-16_xx.png
- Rebuild and restart your project