Customize languages in AEM 6.2

Adobe Experience Manager is completely flexible and can be configured for any language. AEM inherently understands all ISO language codes, both 2 letter locales (en, fr, de) as well as 5 letter locales (en-US, fr-FR, de-DE).
Language codes play most important role while you create and translate site in multiple languages. As per W3C standards, you should use dashes in the locale codes when they are part of the url structure, like de-de, fr-fr etc. For reference, see Language tags in HTML and XML.
In AEM 6.2 when you create language copies using the References Panel, you will be able to create sites with language codes that have dashes in the language codes. However, when you try to translate those pages using Translation Projects, you will not be able to create Translation Projects, if the language codes do not match the ones in the Translation Project.
Translation Projects in AEM come with a list of preconfigured languages and associated language codes, however these codes do not follow the W3C standards. If you are curious, you can find the list of languages here: /libs/wcm/core/resources/languages. If you wish to change this list, either for adding more languages or use W3C standard locales for the same languages, you would need to make modifications to this list. As we all know, we should never change anything under /libs. What we should instead do is, override the list in /apps.
In the following step by step procedure, I will walk you through how to override languages in AEM Projects.
Prerequisite:
Before we go ahead with the procedure, you will need to patch to AEM 6.2. Please download cq-6.2.0-hotfix-11808 from Package Share and install it in your instance.
OOTB languages in AEM Projects:
The list of available languages can be seen in the advanced properties tab of Translation Project.

Picture1.png

As you would see, all the language codes are dashes.
We are going to make two changes:
Change underscores in language codes (de_de) to dashes (de-de)
Add an additional Indian language. We will add Punjabi (pa) a language commonly spoken here at our office.
Steps:

  • In order to make these changes, we will need to make changes in CRXDE.
  • Open up CRXDE (http://localhost:4502/crx/de/index.jsp) and then browse to /libs/wcm/core/resources/languages
  • Here you will see the list of languages that you see in the Translation Project. The language list is sorted by language code and not language name.
  • Please note: DO NOT MAKE CHANGES in this list. /libs is restricted and the changes can be overwritten by AEM installers.
  • We will override this list in /apps. We will follow the same path as in libs, but just replace libs with /apps.
  • Browse to /apps/wcm in CRXDE. You would observe that we do not have a core folder under wcm. We will need to recreate the rest of the structure.
  • Create a new folder names core, under /apps/wcm, and Save All.
  • Now we will go back to the resources folder under /libs. Browse to (/libs/wcm/core/resources). Select resources node and Copy it.
  • Now browse back to the core folder under /apps (/apps/wcm/core); select core and paste the copied content here and then Save All.
    Note: In case you see an error, it is because you have not saved the core folder, that we created in the previous step.
  • Next, we will iterate over all the language nodes and replace underscores “_” with dashes “-”, do that “de_de” will be replaced with “de-de”.

Picture2.pngPicture3.png

BEFORE                                                                             AFTER

  • Next, we will add the additional Indian language Punjabi (pa). For doing so we will need to create a new node and name it pa.
  • The node will get added at the bottom of the languages list. Once the node is created, add two properties, both of string type, language and country, as shown below:

Picture4.png

  • Save all the changes and restart AEM.
  • Now when you create a new project, you shall see the updated list of language codes, with dashes instead of underscores.

Picture5.png

  • You will also be able to see the newly added language: Punjabi

Picture6.png

Hence using this procedure, you can update the list of languages as well as codes in Translation Projects. If you have any questions, I would love to have conversation with you. You can always reach me out on my email <prafful.jain@gcell.in>.

About Me:
I am the CTO of the Digital Marketing practice at GCell. I have spent my last 15 years, building as well as customizing various Content Management and Marketing Publishing Solutions. I have deep interest in Digital Marketing. Apart from helping multiple marketing teams execute on their strategy, I have also helped them measure effectiveness of marketing, using data driven technologies and analytics. If you have a need in any of these area, I would love to have a conversation with you.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s