AEM i18n from Javascript (try 2)
Apologies for the duplicate post. Seems like something in the original is breaking the page, so I'll try this again:
I'm trying to dynamically retrieve a translated message using Javascript from my created dictionary in AEM's translator (/libs/cq/i18n/translator.html).
We've got dictionary values set up like:
String EN FR
========================================================
TEST-001 This is a Test1 FR:This is a Test1
TEST-002 This is a Test2 FR:This is a Test2
TEST-003 This is a Test3 FR:This is a Test3
I've looked through the Internationalizing UI Strings article (https://docs.adobe.com/docs/en/aem/6-2/develop/components/i18n/i18n-dev.html) but when I try to the following:
Granite.I18n.setLocale("en");
Granite.I18n.get("TEST-001");
or
Granite.I18n.setLocale("fr");
Granite.I18n.get("TEST-001");
I only get returned the string I've passed in (i.e. "TEST-001").
Could someone help me understand how to retrieve the translated value back?
Thanks!