掲示板

Liferay.Language.get(' …') is synchronous call or asynchronous

thumbnail
7年前 に Sagar A Vyas によって更新されました。

Liferay.Language.get(' …') is synchronous call or asynchronous

Liferay Master 投稿: 679 参加年月日: 09/04/17 最新の投稿
Hi,

I tried to google it but did not get an answer , thought this would be right forum to ask as always.

I want to use Liferay.Language.get() for reading Language.properties in java script file, our team wants to make sure it is not synchronous call as it will cost more, so can anyone let me know ? what is it actually ?

Thanks,
Sagar Vyas
thumbnail
7年前 に Chema Balsas によって更新されました。

RE: Liferay.Language.get(' …') is synchronous call or asynchronous (回答)

Regular Member 投稿: 127 参加年月日: 13/02/25 最新の投稿
Hey Sagar,

All occurrences of Liferay.Language.get('key') inside JavaScript files are converted to their translated values if the language property is found. If you inspect the returned source code from the server, you shouldn't find the Liferay.Language.get in your code.

In case the language property is not found, then the code will stay as is and execute the code which is indeed a sync ajax request

In summary, you should have no problem as long as you're referring existing keys.
thumbnail
7年前 に Sagar A Vyas によって更新されました。

RE: Liferay.Language.get(' …') is synchronous call or asynchronous

Liferay Master 投稿: 679 参加年月日: 09/04/17 最新の投稿
Chema Balsas:
Hey Sagar,

All occurrences of Liferay.Language.get('key') inside JavaScript files are converted to their translated values if the language property is found. If you inspect the returned source code from the server, you shouldn't find the Liferay.Language.get in your code.

In case the language property is not found, then the code will stay as is and execute the code which is indeed a sync ajax request

In summary, you should have no problem as long as you're referring existing keys.


Hi Chema ,

Thanks for your reply, appreciate it.

This is helpful.

Thanks,
Sagar Vyas