localizationaem

How to add new languages to AEM Tags for localisation?


The AEM Tags console allows localised titles to be added to each tag.

Editing an AEM tag. There's a list of languages visible on the right-hand side listing English, German, Spanish, French, etc.

However, this list is missing some of the locale codes I need to support. What is the source of this list? There is a basic configuration for available languages under /libs/wcm/core/resources/languages but it contains a lot more entries than this dropdown menu.


Solution

  • This dropdown is handled by the script under /libs/cq/tagging/gui/components/tagedit/languagepicker/render.jsp

    The original source of the list of tags, as per this JSP, is the com.day.cq.tagging.TagManager interface.

    This means we need to determine what drives the list of tags returned by com.day.cq.tagging.TagManager#getSupportedLanguageCodes() and how to add supported languages to AEM's TagManager.

    Global configuration in AEM is often contextual, likely a JCR property near the root of a content sub-tree, a Sling Context-Aware Configuration, or similar.

    Let's take a guess and look at the root of the AEM Tags content tree: /content/cq:tags

    This node has a JCR property named languages, of type String[]. This looks like a good candidate. Here's the value I found on my instance: en, de, es, fr, it, pt_br, zh_cn, zh_tw, ja, ko_kr

    Extending this list appears to do the trick. I've added de_de to the list and the option German (Germany) showed up in the dropdown.

    Editing an AEM Tag. The same UI as in the question, with a new langauge, German(Germany) added to the end of the list

    For any custom locale code added this way, it also needs to be present in the global list under /libs/wcm/core/resources/languages or under its overlay under /apps/wcm/core/resources/languages