Notifications

583 views

Description

 

Symptoms


getMessage() can be used to display text in different places the platform. Sometimes the translations for the text found inside of getMessage() does not get translated.

EXAMPLE:

 
Catalog Client Scripts containing an alert that would not get translated in portal
 
function onChange(control, oldValue, newValue, isLoading) {

if(newValue == '1'){

alert(getMessage('Test : English version'));

}

}
 
The image below shows how the "alert(getMessage('Test : English version'))" will look like in action on a instance in Portuguese mode:

 

Release


Jakarta, Kingston, London

 

Cause


By design, Service Portal and Mobile client scripting environments do not support synchronous use of getMessage(). However, a getMessage() with a callback function can be used to translate text from getMessage(). To see an example of how the translation can be done, see the solution section next.
 
 
Resolution

This is a sample code that would work with the Example given in the Symptoms section of this article. Replace the "alert(getMessage('Test : English version'))" by the following:
 

getMessage('Test : English version', function(msg){alert(msg);});

Article Information

Last Updated:2019-08-02 21:06:03
Published:2018-09-07