AEM i18n

AEM i18n allows us to show localized text which is nothing but internationalization.

OOTB AEM helps us to shown language based text depending on URL having language or region.

Below is the highlighted hierarchy in red we are going to follow for localization. As part of current development we are going to consider English and French.

Follow below steps to load project specific locale text:

1. Create an i18n folder beneath /apps/<project_name>/ hierarchy. 

2. Create .content.xml file inside i18n folder and place below content.

3. Create en.xml file inside same i18n folder to support English language.

4. Create fr.xml file inside same i18n folder to support French language.

5. Open practice component’s practice.html file to place below line for showing localized text for hello.world
${‘hello.world’ @ i18n}

6. Trigger build and deploy packages on publish instance.
mvn clean install -PautoInstallPackage -DskipTests=true

7. Once build is done, it will create below node hierarchy

http://localhost:4502/crx/de/index.jsp#/apps/practice/i18n/fr/hello.world

8. Open below URL and select i18n project to see latest changes as shown below:

http://localhost:4502/libs/cq/i18n/translator.html

9. Create en and fr node to support English and French language. Create test page beneath both the languages. Drag and drop practice component on test page for both en and fr locale.

10. Verify if i18n data is loading for newly added property by hitting below URL’s and search for hello.world using ctrl+f 

http://localhost:4502/libs/cq/i18n/dict.en.json

http://localhost:4502/libs/cq/i18n/dict.fr.json

11. Hit below URL to show English and French language.

English: http://localhost:4502/content/practice/us/en/test.html

French: http://localhost:4502/content/practice/us/fr/test.html

Imran Khan

Specialist Master (Architect) with a passion for cutting-edge technologies like AEM (Adobe Experience Manager) and a proven track record of delivering high-quality software solutions.

  • Languages: Java, Python
  • Frameworks: J2EE, Spring, Struts 2.0, Hibernate
  • Web Technologies: React, HTML, CSS
  • Analytics: Adobe Analytics
  • Tools & Technologies: IntelliJ, JIRA

🌐 LinkedIn

📝 Blogs

📧 Imran Khan