Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Multilingual component dialog

Avatar

Level 2

Can anyone point me to some document referring how to create component dialog in multilingual fashion. All the UI fields in the dialog should be based on language the author is editing. TIA

1 Accepted Solution

Avatar

Correct answer by
Level 10

I remember I tried these steps sometime back,

Do check these steps for have I18n in dialogs

http://teknopoint.us/internationalization-of-adobe-cq5-authoring-i18n/

View solution in original post

6 Replies

Avatar

Community Advisor

SDharmaraj wrote...

Can anyone point me to some document referring how to create component dialog in multilingual fashion. All the UI fields in the dialog should be based on language the author is editing. TIA

 

can you explain your question with more details ?

Thanks,

Mani Kumar K

Avatar

Correct answer by
Level 10

I remember I tried these steps sometime back,

Do check these steps for have I18n in dialogs

http://teknopoint.us/internationalization-of-adobe-cq5-authoring-i18n/

Avatar

Administrator

Hi

Please have a look at these two approach:

Link:- http://www.aemcq5tutorials.com/tutorials/implement-internationalization-in-adobe-cq/

//

Internationalization can be achieved by using i18n bundle approach in adobe CQ or AEM(Adobe Experience Manager). Based on our use-case/requirement there are different approaches to implement internationalization in adobe cq.

 

Let’s see both the approaches to implement internationalization in Adobe CQ –

 

Approach 1

If we have to print and value in js(JavaScript) file we can directly use granite api.

For Ex:- Granite.I18n.get("Letter created successfully.")

 

Approach 2

If we want to display certain text in different language based on URL,page language or region detected by browser. Then we should use internationalization feature of CQ.

Let’s understand how to implement it with an example:-

  • Create a i18n node under /apps// of type sling:Folder.
  • Create a node of type sling:Folder under i18n of mixin type mix:language.
  • Add a jcr property called jcr:language and assign value of lang code or lang_COUNTRY.

 

Read the article to get full details of the same.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

Avatar

Level 2

edubey wrote...

I remember I tried these steps sometime back,

Do check these steps for have I18n in dialogs

http://teknopoint.us/internationalization-of-adobe-cq5-authoring-i18n/

 

 Thanks for the link, i was looking specifically for the dialog UI field's label. Appreciate it.

Thanks everyone!

Avatar

Level 5

Does this worked "http://teknopoint.us/internationalization-of-adobe-cq5-authoring-i18n/" I have followed the same steps. but it is not able to fetch the I18N label values with the key name. instead it displays the key name itself treated as the value for the dialog widget and shows in the dialog. any inputs for implementation.?

Avatar

Level 2

kk krish wrote...

Does this worked "http://teknopoint.us/internationalization-of-adobe-cq5-authoring-i18n/" I have followed the same steps. but it is not able to fetch the I18N label values with the key name. instead it displays the key name itself treated as the value for the dialog widget and shows in the dialog. any inputs for implementation.?

 

It worked for me but only after made sure the locale is loading properly for language pages. Do this test. 

Browse the page where you have this component , open the browser console and run Granite.I18n.getLocale(). It should give "fr" or "de" or whatever language you are looking for. 

One strange thing i noticed is if we have /cf# in the URL , Granite.I18n.getLocale() always returns "en" and if i remove /cf# from the URL , Granite.I18n.getLocale() gives the correct locale string. 

If the locale is not set properly, make sure you set the language for the page in page properties and set the locale from the request by code in the page component like below

 

<%@include file="/libs/foundation/global.jsp" %>

<%@ page import="com.day.cq.i18n.I18n, java.util.ResourceBundle,java.util.Locale" %>

<%

     Locale pageLang = currentPage.getLanguage(false);
    ResourceBundle resourceBundle = slingRequest.getResourceBundle(pageLang);
    I18n i18n = new I18n(resourceBundle); 

%>

<script>
    Granite.I18n.setLocale("<%=pageLang%>");
</script>

Hope this helps.