Provide Javascript API to retrieve single translations | Community
Skip to main content
Level 2
August 9, 2021
Investigating

Provide Javascript API to retrieve single translations

  • August 9, 2021
  • 2 replies
  • 731 views
Request for Feature Enhancement (RFE) Summary: There is an OOTB function CQ.I18n.getDictionary() to get translations, but it always gets the whole dictionary to the UI, which puts much load on the visitor's browser. This reuest is to provide a function that retrieves only the requested translations. E.g. it could accept key name(s) and language name as parameters.
Use-case: Use localized strings in custom JS code on user-facing pages.
Current/Experienced Behavior:  
Improved/Expected Behavior:  
Environment Details (AEM version/service pack, any other specifics if applicable): AEM 6.5 with SP8
Customer-name/Organization name: Veeam Software
Screenshot (if applicable):  
Code package (if applicable):  

2 replies

Akash_Kapoor
Adobe Employee
Adobe Employee
September 6, 2021

Hi @alexander_prikhodko 

 

Thanks for proposing the idea.

This request has been raised to the product team via the Jira CQ-4331470. The product team will triage this request to verify feasibility based on the prioritization model. This post will be updated according to the Jira request status.

 

Thanks,

Akash

arunpatidar
Community Advisor
Community Advisor
November 5, 2021

Hi @alexander_prikhodko 

Could you please check if below code fulfill your requirement?

if (CQ && CQ.I18n) { CQ.I18n.setLocale("de_DE"); var localizedMessage = CQ.I18n.getMessage("Go"); console.log(localizedMessage) }

 

Arun Patidar