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 msgKey value.
The msgKey parameter should pass the string for translation, and the callback parameter is the function that will be executed after the server response.
Please note that this method is asynchronous; for better performing, use theawaitkeyword like shown in the code example below.
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')) {
await 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 msgKey string values.
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.
Please note that this method is asynchronous; for better performing, use theawaitkeyword like shown in the code example below.