Foros de discusión

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

thumbnail
Sagar A Vyas, modificado hace 7 años.

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

Liferay Master Mensajes: 679 Fecha de incorporación: 17/04/09 Mensajes recientes
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, modificado hace 7 años.

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

Regular Member Mensajes: 127 Fecha de incorporación: 25/02/13 Mensajes recientes
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, modificado hace 7 años.

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

Liferay Master Mensajes: 679 Fecha de incorporación: 17/04/09 Mensajes recientes
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