You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

This class provides methods to get translated messages. This class has no constructor; methods can be accessed using the s_i18n global object.

getMessage(msgKeys, callback)


This method returns a string containing message in a user language.

The msgKeys parameter should pass the string for translation, and the callback parameter is the function that will be executed after the server response.

If the specified string exists for the current language, then the translated language is returned. If the specified string does not exist for the current language, or it does not exists at all, then the English version of the string is returned.

This method will get only the message that has the Category attribute equal to 'app'.


Parameter(s):

NameTypeMandatoryDefault Value
msgKeysStringYN
callbackfunctionYN


Return:

TypeDescription
VoidThis method does not return a value.


Example:

s_i18n.getMessage('notification', (response) => {
s_form.addOption('state', '5', response);
})

getMessages(msgKeys, callback)


This method returns an array of strings that contains messages in a user language.

The msgKeys parameter should pass the array of strings for translation, and the callback parameter is the function that will be executed after the server response.

If the specified string exists for the current language, then the translated language is returned. If the specified string does not exist for the current language, or it does not exists at all, then the English version of the string is returned.

This method will get only the messages that have the Category attribute equal to 'app'.


Parameter(s):

NameTypeMandatoryDefault Value
msgKeysArrayYN
callbackfunctionYN


Return:

TypeDescription
VoidThis method does not return a value.


Example:

const arr = ['Open', 'Close'];
s_i18n.getMessages(arr, (response) => {
console.log(response);
})

  • No labels