留言板

Multilanguage Portlets

kiesa viciius,修改在12 年前。

Multilanguage Portlets

Junior Member 帖子: 28 加入日期: 11-8-22 最近的帖子
Hey,

I'm developing portlets with Vaadin in a Liferay Portal , mostly with english component captions(names) like "Cancel" "back" "next" and so on. Now i have to make the portlets "Multilanguage ready" that means if an user has set the language of his Liferay page to english he should see my portlet captions in english , but if an user sets the language of his Liferay page to german, the portlet captions should be displayed in german.

Is there a way to check wich language the user has set as his main Language ?

an easy Example :

John is from New York his main language is english so as soon as he logins to his account the language of the Portlet component captions should be displayed in english

Heinz is from Berlin his main language is german so as soon as he logins to his account the language of the Portlet component captions should be displayed in german.
thumbnail
Sandeep Nair,修改在12 年前。

RE: Multilanguage Portlets

Liferay Legend 帖子: 1744 加入日期: 08-11-6 最近的帖子
Hi,

You can get the languageId of the user from Themedisplay.
Use themeDisplay.getLanguageId()

Regards,
Sandeep
kiesa viciius,修改在12 年前。

RE: Multilanguage Portlets

Junior Member 帖子: 28 加入日期: 11-8-22 最近的帖子
Hey ,

it took me some time but i got it emoticon now i can get the user information i want. now i have some problems with the Language.properties file , i just cant get the translated strings out of it , for the translation i only get the Liferay default translations, not my created translations:/
thumbnail
Arno Broekhof,修改在12 年前。

RE: Multilanguage Portlets

Junior Member 帖子: 42 加入日期: 11-10-18 最近的帖子
have you used:

<%= LanguageUtil.get(pageContext, "defined-string-in-portal.properties") %>

or
<liferay-ui:message key="defined-string-in-portal.properties" />


did you also do an ant build-lang or if you are using liferay ide: Liferay -> Build Language
thumbnail
Hitoshi Ozawa,修改在12 年前。

RE: Multilanguage Portlets

Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
Is there a way to check wich language the user has set as his main Language ?


I think what you really want is the "current" language the user has chosen to display the current pages instead of the "main" language in user's display setting.