내 커뮤니티 업적 표시줄을 확대합니다.

Mark Solution

활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.

해결됨

How to load only part of the dictionary in AEM 6.0?

Avatar

Level 4

Hello,

I'm using AEM6.0 with SP3.

In javascript we are loading part of the transation with CQ.I18n.getMessage method.

/libs/cq/i18n/dict.en_us.json returns only custom translation, but /libs/cq/i18n/dict.de_de.json in additional to our custom translation returns also AEM OOTB translations.

How I can prevent this for publish instance?

Thank you in advance

1 채택된 해결책 개

Avatar

정확한 답변 작성자:
Employee Advisor

Hi,

so do I understand you correct?

  • When you hit /libs/cq/i18n/dict.en_us.json with your browser, you get only the custom translations (= the translations you provided)
  • When you hit /libs/cq/i18n/dict.de_de.json with your browser, you get the custom translations plus the ootb german translations

Is this correct? And you have put your custom translations below /apps/my-project/i18.

Which version of AEM do you have? Can you provide the exact version of the bundle "org.apache.sling.i18n"?

kind regards,
Jörg

원본 게시물의 솔루션 보기

13 답변 개

Avatar

Level 10

The only info that I could find related to this question is located here:

https://docs.adobe.com/docs/en/aem/6-0/develop/components/i18n/translator.html

Avatar

Employee Advisor

Hi,

where in the repository have you placed your custom translations?

kind regards,
Jörg

Avatar

Level 4

Hi Jörg,

/apps/my-project/i18n

Thanks,

Alex

Avatar

정확한 답변 작성자:
Employee Advisor

Hi,

so do I understand you correct?

  • When you hit /libs/cq/i18n/dict.en_us.json with your browser, you get only the custom translations (= the translations you provided)
  • When you hit /libs/cq/i18n/dict.de_de.json with your browser, you get the custom translations plus the ootb german translations

Is this correct? And you have put your custom translations below /apps/my-project/i18.

Which version of AEM do you have? Can you provide the exact version of the bundle "org.apache.sling.i18n"?

kind regards,
Jörg

Avatar

Level 2
Hi Jörg, I still that happening in AEM 6.4 and 6.5. We do have our custom translations. Right now there are three languages: en, es and zh. /libs/cq/i18n/dict.es.json returns OOTB values, how to prevent this? zh and en works as expected.

Avatar

Level 4

Hi,

>>When you hit /libs/cq/i18n/dict.en_us.json with your browser, you get only the custom translations (= the translations you provided)

>>When you hit /libs/cq/i18n/dict.de_de.json with your browser, you get the custom translations plus the ootb german translations

>>Is this correct? And you have put your custom translations below /apps/my-project/i18.

Correct.

>>Which version of AEM do you have?

AEM6.0 + SP3

Can you provide the exact version of the bundle "org.apache.sling.i18n"?

2.2.8

Thanks,

Alex

Avatar

Level 4

Any updates?

Avatar

Level 2

Hi Alex, could you find any solution for this? Even we are facing same issue.

Thanks,

Mohan

Avatar

Level 4

Hello,

We deactivated OOTB dictionaries from publish instance.

Thanks,

Alex

Avatar

Level 2

Thanks Alex, for the info. Did you deactivate dictionaries at /libs/wcm/core/i18n in publish instance or using Guide Localization Service or overlayed  /libs/wcm/core/i18n with your custom or blank dictionaries?

- Mohan

Avatar

Level 4

We just deactivated /libs/wcm/core/i18n from publish instance

-Alex

Avatar

Level 2

Ok, thank you - Mohan

Avatar

Level 2

We faced the similar requirement to fetch I18n values at client side using Granite.i18n Library

This is what I did.

1) Created a custom servlet which returns JSON response similar to ResourceBundleExportServlet

2) Loaded the bundle using basename and locale parameter - ResourceBundle resourceBundle = req.getResourceBundle(basename, pageLocale);

3) Added 'sling:basename="basename_constant"' in language specific i18n xml file which resides in /apps/project-name/i18n folder. In my case, I am setting the value of locale itself ex: "zh_cn"

4) In clientlibs javascript file setting Granite.I18n.setUrlPrefix("/bin/custom/i18n/dict."); to fetch from custom servlet URL.