This class provides a method that works with the localization data.

SimpleMessage()


Use this constructor to instantiate a new empty object of the SimpleMessage class.

Example:

SimpleMessage()
const message = new SimpleMessage();

getMessage(message, category, params, language)


Use this method to translate the specified message. 

Parameter(s):

NameTypeMandatoryDefault value
messageStringYN
categoryStringNapp
paramsObjectN{ }
languageStringNnull

Return:

TypeDescription
StringThe method returns a message in the current user's language.

Example:

getMessage()
const message = new SimpleMessage();
const messageValue =
  message.getMessage(
    'cannot be blank',
    'app',
    {"column_translated_title": "Field Name", "column_name": "field_name"}
  );
ss.info(messageValue);
// Info: The "{column_translated_title}" [{column_name}] field is mandatory.

And as an example, the message settings are as follows:

Example:

getMessage()
const message = new SimpleMessage();
const localizedMessage = message.getMessage('Spaces are not allowed in a table name');
ss.addErrorMessage(localizedMessage);

You can also add localized messages without the getMessage method:

errorMessage()
ss.addErrorMessage('Spaces are not allowed in a table name');

See the Localization and Multi-Language Support article to learn more about message configurations.

  • No labels