Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Provide Javascript API to retrieve single translations

Avatar

09-08-2021

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 Comments

Avatar

Employee Advisor

06-09-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

Status changed to: Investigating

Avatar

Community Advisor

05-11-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)
}