This class provides methods returning translated messages. This class has no constructor; methods can be accessed using the s_i18nglobal object.
getMessage(msgKey, callback)
This method returns a string containing a message in a user language for a specified string. If this string does not have localization for the current language, or it does not exist at all, the method returns the English version.
The msgKeys parameter should pass the string for translation, and the callback parameter is the function that will be executed after the server response.
This method will get only the message that has the Category attribute equal to 'app'.
Parameter(s):
Name
Type
Mandatory
Default Value
msgKey
String
Y
N
callback
function
Y
N
Return:
Type
Description
Void
This method does not return a value.
Example:
if (!s_form.getValue('condition') && !s_form.getValue('script')) {
s_i18n.getMessage('Specify conditions in "Condition" [condition] or "Script" [script] fields.', (response) => {
s_form.addErrorMessage(response);
});
return false;
}
getMessages(msgKeys, callback)
This method returns an array of strings that contains messages in a user language. If these strings do not have localization for the current language, or they do not exist at all, the method returns the English versions.
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.
This method will get only the messages that have the Category attribute equal to 'app'.