Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Nilesh Gundecha
Page Title Localization
May 18, 2011 3:47 AM
Answer

Nilesh Gundecha

Rank: Regular Member

Posts: 196

Join Date: November 30, 2009

Recent Posts

Hi Friends,

I want the page names to be localized. What I mean is - On the Top Navigation Bar, I shall get the Page/Tab Names as per the locale I have selected.
Can anyone please provide me some inputs on this? I am using Liferay's Classic theme.

I checked whether same is working on liferay.com or not?? And I found that its working on liferay.com. Its just to my surprise it was only not working when I selected Japanese language. (Don't know why???)

Please let me know How I will be able to achieve this?? All the pages I am creating programmatically using below code snippet : -

1
2com.liferay.portal.model.Layout layout = LayoutLocalServiceUtil.addLayout(group.getCreatorUserId(), group.getGroupId(), privateLayout,
3            LayoutConstants.DEFAULT_PARENT_LAYOUT_ID, name, StringPool.BLANK, StringPool.BLANK,
4                        LayoutConstants.TYPE_PORTLET, false, friendlyURL, serviceContext);


Any help would be highly appreciated??

Thanks and Regards,
Nilesh.
Nilesh Gundecha
RE: Page Title Localization
May 23, 2011 11:58 PM
Answer

Nilesh Gundecha

Rank: Regular Member

Posts: 196

Join Date: November 30, 2009

Recent Posts

Can anyone provide some inputs on this?? I got the solution how to achieve this via Control Panel. All we have to do is as below: -
1) Go to Control Panel
2) Select "Pages" in left hand side list
3) Select the desired page
4) And then click on the "Page" tab
5) You can see the drop down menu with title as "Localized Language:"
6) Select the locale and provide corresponding localized name.
7) SAVE.

Thats it.

But all this I want to do programmatically. Does anyone know what API should I refer for this??


Thanks and Regards,
Nilesh.
Jelmer Kuperus
RE: Page Title Localization
March 30, 2013 5:21 AM
Answer

Jelmer Kuperus

Rank: Liferay Legend

Posts: 1192

Join Date: March 10, 2010

Recent Posts

Something like this probably:

 1com.liferay.portal.model.Layout layout = LayoutLocalServiceUtil.addLayout(
 2  group.getCreatorUserId(),
 3  group.getGroupId(),
 4  privateLayout,
 5  LayoutConstants.DEFAULT_PARENT_LAYOUT_ID,
 6  new HashMap<Locale, String>() {{
 7            put(LocaleUtil.getDefault(), "Default name");
 8            put(new Locale("nl", "NL"), "Dutch name");
 9  }},
10  Collections.<Locale, String>emptyMap(),
11  Collections.<Locale, String>emptyMap(),
12  Collections.<Locale, String>emptyMap(),
13  Collections.<Locale, String>emptyMap(),
14  LayoutConstants.TYPE_PORTLET,
15  false,
16  friendlyURL,
17  serviceContext
18);