How to implement translation i18n on AEM 6.4 SPA Application | Community
Skip to main content
Level 2
April 9, 2019

How to implement translation i18n on AEM 6.4 SPA Application

  • April 9, 2019
  • 3 replies
  • 6877 views

Hello All,

We are building a SPA application on AEM 6.4. Additionally, we are required to implement the i18n/translation for this SPA application.

Could you please help with the necessary steps? Can we implement it the same way we do it for normal AEM website in AEM 6.3 by creating dictionary and using @i18n directives while content authoring/component html file? Or we have to follow a different way of implementing for SPA website in AEM 6.4? 

Any pointers would be of great help. Please advise. Thank you.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

joerghoh
Adobe Employee
Adobe Employee
April 9, 2019

In that case I would implement logic in the SPA which loads the proper i18n dictionary as JSON from AEM.

Adobe Employee
April 10, 2019

> using @i18n directives while content authoring/component html file

Not sure what exactly you mean here. FWIU, @i18n directives are used in HTL. For SPA components, html will not be provided by HTL, but will be generated client-side via the SPA JS. You might want to use the clientside i18n API - Granite.i18n.get

Adobe Employee
April 11, 2019

nileshdchavan Could you please elaborate on your use-case? First, if you want to have the content to be translated, you should leverage the language-copy mechanism [0]. If you are looking for labels and messages, Granite.i18n isn't by default available in the page and we may have to define a strategy to give you access to the internationalization in the context of the page. But before considering such a strategy, we would need to better understand the requirement and eventually consider the most appropriate solution.

[0] Language Copy Wizard

Level 2
October 20, 2021

Hi all, @patrick_fauchere ,We are also planning to use I18n in react spa with AEM. Like @nileshdchavan mentioned, is there a way to mitigate the compilation error of using granite i18n library outside AEM or use a Rest based service or servlet to expose I18n dictionary to react app? please suggest.