留言板
Liferay.Language.get(' …') is synchronous call or asynchronous
Sagar A Vyas,修改在7 年前。
Liferay.Language.get(' …') is synchronous call or asynchronous
Liferay Master 帖子: 679 加入日期: 09-4-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
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
Chema Balsas,修改在7 年前。
RE: Liferay.Language.get(' …') is synchronous call or asynchronous (答复)
Regular Member 帖子: 127 加入日期: 13-2-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.
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.
Sagar A Vyas,修改在7 年前。
RE: Liferay.Language.get(' …') is synchronous call or asynchronous
Liferay Master 帖子: 679 加入日期: 09-4-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