Translation from adobe library | Community
Skip to main content
Level 4
October 16, 2015
Solved

Translation from adobe library

I need to get the translation for the key words mentioned below .i need a way to get the adobe internal library. Please let me know how to do it. I am using <fmt:message key="${keyword}" /> . 

 
I  could use 
 
/apps/project/i18n/en_US
/apps/project/i18n/nl_NL
 
but i am looking  from existing adobe library so that i need not do anything here.As  it is a generic locale list.


de_DE
es_ES
fr_FR
ja_JP
ru_RU
pt_PT
zh_CN
nl_NL
ko_KR
en

de
es
fr
ja
ru
pt
zh
nl
 
 
 
For the above keywords it must pick up based on locale so if  I am on english based page url locale
http://localhost:4503/content/corporate/cworld/en_US/generic.html
 
 
then  the translated content for "en" must be displayed "English"
 
 
If i am in  nl based page url
 
http://localhost:4503/content/corporate/cworld/nl_NL/generic.html
 
then  the translated content for "en" must be displayed "engels"
 
Thanks,
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
edubey
edubeyAccepted solution
Level 10
October 16, 2015

Values stored in i18n can easily be accessed via java code. You need to get the locale object

<%@page session="false"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> <%@page import="java.util.Locale,java.util.ResourceBundle,com.day.cq.i18n.I18n"%> <%@include file="/libs/foundation/global.jsp"%> <cq:setContentBundle/> <% final Locale pageLocale = currentPage.getLanguage(false); final ResourceBundle resourceBundle = slingRequest.getResourceBundle(pageLocale); I18n i18n = new I18n(resourceBundle); %> <%= i18n.get("cartItem") %>

Here are some helpful reference links as well:-

http://blogs.adobe.com/dekesmith/2012/10/21/internationalization-within-sling-and-cq/

http://hootcook.blogspot.in/2013/02/cq5-internationalization.html

http://www.albinsblog.com/2014/12/implementing-internationalization-with.html#.Vf2L6X0po3Y

5 replies

edubey
Level 10
October 16, 2015

Hi,

Also please take care of path where you should have language node, it should be

/content/project/langauge-node/wesbite-pages.

Your path doesn't follow this. Here is the Documentation for the same : http://docs.adobe.com/docs/en/cq/5-6-1/administering/multi_site_manager.html#Managing%20Different%20Language%20Versions%20of%20a%20Website

Translate
edubey
Level 10
October 16, 2015

Hi,

You can use translator page to edit values http://localhost:4502/libs/cq/i18n/translator.html

Translate
Level 4
October 16, 2015

But How to  use it .For example The  list above i have mentioned does not chage when i use  say <fmt:message key="es_ES" /> to  Spanish

Any inputs here  how could i use  it

Translate
edubey
edubeyAccepted solution
Level 10
October 16, 2015

Values stored in i18n can easily be accessed via java code. You need to get the locale object

<%@page session="false"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> <%@page import="java.util.Locale,java.util.ResourceBundle,com.day.cq.i18n.I18n"%> <%@include file="/libs/foundation/global.jsp"%> <cq:setContentBundle/> <% final Locale pageLocale = currentPage.getLanguage(false); final ResourceBundle resourceBundle = slingRequest.getResourceBundle(pageLocale); I18n i18n = new I18n(resourceBundle); %> <%= i18n.get("cartItem") %>

Here are some helpful reference links as well:-

http://blogs.adobe.com/dekesmith/2012/10/21/internationalization-within-sling-and-cq/

http://hootcook.blogspot.in/2013/02/cq5-internationalization.html

http://www.albinsblog.com/2014/12/implementing-internationalization-with.html#.Vf2L6X0po3Y

Translate
Lokesh_Shivalingaiah
Level 10
October 16, 2015

<fmt:message> is not there with sling. as @edubey mentioned use i18n.get()

However, make sure you have all the dictionary built for the words you need.

Refer these which might help

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

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

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

Translate