フォーラム

ホーム » Liferay Portal » English » 3. Development

構造的に表示 平面上に表示 ツリー上に表示
スレッド [ 前へ | 次へ ]
toggle
Tejas Kanani
How to get language property value inside javascript function ?
2012/11/29 0:23
答え

Tejas Kanani

ランク: Liferay Master

投稿: 655

参加年月日: 2009/01/06

最近の投稿

Hi,

I want to get language property value inside my javascript function, and after searching in forums found below code for the same.
Liferay.Language.get("key")

When I've used the above code in my Custom Plugins portlet, It just returning me the Key itself instead of the value from my Language_en.properties file. After some more googling found that it only works with portal level language property and not portlet level.

I am using Liferay 6.1.

Is anyone came across such issue and able to find a solution for this problem ?
Any pointer would be appreciated.

Thanks,
Tejas
Oliver Bayer
RE: How to get language property value inside javascript function ?
2012/11/29 0:40
答え

Oliver Bayer

ランク: Liferay Master

投稿: 883

参加年月日: 2009/02/18

最近の投稿

Hi Tejas,

you can override or add your language keys into the ext-environment (ext-impl, content). I know it's some sort of a hack but I think it's the quickest solution to get it working emoticon. Otherwise you should check if it's working in the current trunk, look out for maybe already created jira issues or you can try debugging...

Greets Oli
Tejas Kanani
RE: How to get language property value inside javascript function ?
2012/11/29 0:56
答え

Tejas Kanani

ランク: Liferay Master

投稿: 655

参加年月日: 2009/01/06

最近の投稿

Thanks Oliver for quick reply.

But I would like to avoid making changes in ext for simply displaying the language property for my custom portlet. As in future if i want to add any more property to my portlet, everytime I need to make changes in ext and rebuild it, which I want to avoid.

And I've also checked in JIRA and found one issue raised for the same. But its found closed without any useful solution.
http://issues.liferay.com/browse/LPS-14664

Anybody from Liferay Staff Member has any solution/updates for this issue ?

Thanks,
Tejas
Ali Reza Akbarian
RE: How to get language property value inside javascript function ?
2012/11/30 6:48
答え

Ali Reza Akbarian

ランク: New Member

投稿: 6

参加年月日: 2012/04/07

最近の投稿

Hi Tejas

Try This :
LanguageUtil.get(locale, key);

Thanks.
Shashant Panwar
RE: How to get language property value inside javascript function ?
2013/07/31 8:27
答え

Shashant Panwar

ランク: Junior Member

投稿: 28

参加年月日: 2012/09/21

最近の投稿

Hi Tejas,
I hope you resolved the issue. But if not then try using Liferay.Language.get('key'); instead Liferay.Language.get("key"). I got the same issue which you got and resolved it with above solution.

Regards,
Shashant
Pankaj Kathiriya
RE: How to get language property value inside javascript function ?
2013/07/31 8:53
答え

Pankaj Kathiriya

ランク: Liferay Master

投稿: 697

参加年月日: 2010/08/04

最近の投稿

Use liferay-ui:message tag in js.

Sorry for brief ,sent from mobile.
Shashant Panwar
RE: How to get language property value inside javascript function ?
2013/08/01 9:54
答え

Shashant Panwar

ランク: Junior Member

投稿: 28

参加年月日: 2012/09/21

最近の投稿

Pankaj Kathiriya:
Use liferay-ui:message tag in js.

Sorry for brief ,sent from mobile.


Can you please paste the syntax, I tried but liferay-ui:message is not working for me in js. Finally I end up using Liferay.Language.get('key');

Regards,
Shashant
Pankaj Kathiriya
RE: How to get language property value inside javascript function ?
2013/08/01 22:06
答え

Pankaj Kathiriya

ランク: Liferay Master

投稿: 697

参加年月日: 2010/08/04

最近の投稿

1<script>
2var message="<liferay-ui:message key='please-enter-a-valid-screen-name'/>";
3</script>
Sandeep Singh
RE: How to get language property value inside javascript function ?
2013/10/02 11:07
答え

Sandeep Singh

ランク: New Member

投稿: 4

参加年月日: 2011/12/02

最近の投稿

Thanks Shashant this worked for " Liferay.Language.get('key'); "

Thanks,
Sandeep