Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

How to Share Selected i18n Dictionaries in JSON Format — AEM(Adobe Experience Manager) | AEM Community Blog Seeding

Avatar

Administrator

BlogImage.jpg

How to Share Selected i18n Dictionaries in JSON Format — AEM(Adobe Experience Manager) by Albinsblog

Abstract

The AEM internationalization framework(i18n) uses dictionaries in the repository to store English strings and their translations in other languages. The framework uses English as the default language. Localized strings can be stored in several dictionaries in the repository, e.g., component level. The AEM internationalization framework combines the dictionaries and makes them available in Sling as a single ResourceBundle object. The i18n can be used in slightly, JavaScript, and Java to display the language-specific labels and values.

In some cases, we may have the use case to share the i18n dictionaries externally.

There are a couple of options to share the dictionaries externally.

RESOURCEBUNDLEEXPORTSERVLET:
By default the dictionaries are exposed using the ResourceBundleExportServlet (com.adobe.granite.i18n.impl.ResourceBundleExportServlet) registered under path /libs/cq/i18n/dict.

e.g

http://localhost:4502/libs/cq/i18n/dict.de_de.json
http://localhost:4502/libs/cq/i18n/dict.de.json
http://localhost:4502/libs/cq/i18n/dict.fr_fr.json
The ResourceBundleExportServlet collects all the dictionaries defined in the AEM system for a particular language and(or) country and exposes them as JSON.

By default, the /libs path is blocked from Dispatcher; the dictionary path should be allowed to access externally. The challenge with this approach is all the available dictionaries are exported as part of the JSON response but will not be able to export the selected dictionaries.

Read Full Blog

How to Share Selected i18n Dictionaries in JSON Format — AEM(Adobe Experience Manager)

Q&A

Please use this thread to ask the related questions.



Kautuk Sahni
1 Reply

Avatar

Community Advisor

Hi @kautuk_sahni ,

 

As you mentioned, "The ResourceBundleExportServlet collects all the dictionaries defined in the AEM system for a particular language and(or) country and exposes them as JSON". I want to is there any way to restrict a particular i18n dictionary from exposing along with others?.