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
Q&A
Please use this thread to ask the related questions.
Kautuk Sahni