Foren

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

thumbnail
Sagar A Vyas, geändert vor 7 Jahren.

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

Liferay Master Beiträge: 679 Beitrittsdatum: 17.04.09 Neueste Beiträge
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
Chema Balsas, geändert vor 7 Jahren.

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

Regular Member Beiträge: 127 Beitrittsdatum: 25.02.13 Neueste Beiträge
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
Sagar A Vyas, geändert vor 7 Jahren.

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

Liferay Master Beiträge: 679 Beitrittsdatum: 17.04.09 Neueste Beiträge
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