The other day, I was in a call where we spent quite some time thinking through how to manage translation of dictionaries in AEM 6.1 and integrate it with the larger translation integration. This has been elegantly solved in AEM 6.2. However, customers still need to jump hoops for older versions. Before I deep dive any further, we first need to understand – what are dictionaries in AEM and why would you want to translate them.
Dictionaries in AEM is a mechanism of externalizing strings used in code (user interface, components, dialogs etc.). It uses SLING Dictionaries as defined here: https://sling.apache.org/documentation/bundles/internationalization-support-i18n.html. In case you have components that render strings on the final published page (example – “Add to Cart” etc), you would need to translate the dictionaries so that these strings that are added via code on the final published page get translated and then rendered in the right language.
In addition, SLING now supports two kinds of formats for dictionaries:
- sling:messageEntry based and
- JSON-file based
and so does AEM.
In order to translate the dictionary, one needs to translate the strings in the target language and add them back as a valid language ISO locale.
Starting AEM 6.2, translating dictionaries is supported out of the box. Translating dictionaries is nicely integrated with AEM Translation Projects. You can translate dictionary either from the Translator Page (http://<hostname>:<port-number>/libs/cq/i18n/translator.html) or from Translation Projects themselves.
Here are the steps to translate a dictionary using AEM Translation Projects:
- Create a Translation Projects from AEM Projects screen (http://<hostname>:<port-number>/projects.html/content/projects).
- Just chose to create a new Project and select “Translation Project” as the template
- Specify a name of the Translation Project, say “Blog”
- Click on “Advanced” section and set the Source Language and the target Language. Also specify the translation metadata. Let’s use Machine Translation and MS Translator (the one that ships with AEM).
4.Choose to open the Project, on the confirmation dialog.
2. Now click on the three dots at the bottom side of the “Translation Job” card.
3. Click on Add and Select “Add Dictionary”
4. This opens up a dialog for you to pick a source dictionary.
It scans all the dictionaries either stored in /libs or /apps. It supports both the dictionary formats as well.
5. Select your source dictionary and it will get added to the Translation Project. It will be treated as yet another asset. You can send the dictionary along with other content (web pages, assets or anything else) that you want to get translated as one single project.
Translator Page [Classic UI]
In addition to the above method, you can also chose to send a dictionary out for translation using the Translator Page. The Page has been updated to add options to send a dictionary out for Translation using the AEM Translation Projects.
Here are the steps to translate a dictionary using AEM Translator Page:
- Open the AEM Translator Page (http://<hostname>:<port-number>/libs/cq/i18n/translator.html) in a browser window.
- You will observe that the page has a new dropdown, with options to “Create a new Translation Project” or “Add to an existing Translation Project” – the same familiar options that you see in the “References” Panel in SITES or ASSETS Admin View.
3. You can select either of the options to add the current dictionary to an AEM Translation Project
4. The dialog lets you select a Destination Language (aka target language) as well as an option to send only the missing translations – aka Update Translation workflows in case you added new Strings.
In case you are not using AEM 6.2 and have an earlier message, the only tool that you have is the option to Export dictionary and then manually toss it over to the translation vendor and once translated import it back in AEM.
With AEM 6.2, there is a nice integration with Machine Translation as well.