-
Notifications
You must be signed in to change notification settings - Fork 38
Multilingual sites adding translations
Here is a list of the steps you need to follow if you want to supply a translation (more detailed explanation below):
- Supply an
<i18n:text>
element around every text that you want to have a translation of. This element should contain an attribute i18n:key the value of which should be something short but descriptive of the element's content. - Define the i18n:key in the list of keys and supply the translation for each language in each
messages_*.xml
document in webapps/ROOT/assets/translations. - Note that the content of the key defined in
messages_*.xml
has priority over the content of the<i18n:text>
element, so the one that will be displayed will be the one coming frommessages_*.xml
. This holds true also when the<i18n:text>
element containing the key is empty. It is still a good practice to leave some content in the default language within the element for human readability.
In main.xmap in the mapmatches for all of the public URLs the last step before serializing is a call to the i18n transformer that Cocoon uses:
<map:transform type="i18n">
<map:parameter name="locale" value="{1}" />
</map:transform>.
This allows us to provide a translation for every text which is within an <i18n:text>
element with an i18n:key attribute. Keys are defined and given content in the messages_*.xml files in webappps/ROOT/assets/translations. There should be one such file per language and all translations for all headers, menu items, text etc. are defined in each of them. When you first download the EFES package, of the provided templates and menus, only assets/templates/home.xml and assets/menu/main.xml have partial i18n markup; this must be added where appropriate.