Cloud Software Group, Inc. EBX®
Documentation > Developer Guide > EBX® Script > API
Navigation mode Documentation > Developer Guide > EBX® Script > API

# Unit core.message

Script unit that provides methods to create and manage user messages

Methods
function addLocale(userMessage: user_message, message: string, locale: locale): user_message Adds a locale to a user message.
function of(message: string, locale: locale): user_message Creates an instance of a user message for a single locale.
function toString(userMessage: user_message, locale: locale): string Formats the message with the specified locale.

## addLocale

function addLocale(userMessage: user_message, message: string, locale: locale): user_message

Adds a locale to a user message.

Example:

    uses core.message as msg;
    export procedure executeScriptTask()()
    begin
      var fr:=locale.of('fr','FR');
      var en:=locale.of('en','EN');
      var messageEn:=msg.of('A new message',en);
      var message:=msg.addLocale(messageEn,'Un nouveau message',fr);
    end

Parameters :

userMessage: the user message.

message: the string message in the locale"s language. If null, the empty string is used.

locale: the locale. if null, the default locale is used.

Return :

a new message with the added locale. If the input userMessage is null, creates a new user message with only the specified locale.

Can be used in: Script tasks, Table triggers, Function fields without search optimization

## of

function of(message: string, locale: locale): user_message

Creates an instance of a user message for a single locale.

Example:

    uses core.message as msg;
    export procedure executeScriptTask()()
    begin
      var en:=locale.of('en','EN');
      var message:=msg.of('A new message',en);
    end

Parameters :

message: the string message in the locale"s language. If null, the empty string is used.

locale: the locale. if null, the default locale is used.

Return :

the new user message.

Can be used in: Script tasks, Table triggers, Function fields without search optimization

## toString

function toString(userMessage: user_message, locale: locale): string

Formats the message with the specified locale.

Example:

    uses core.message as msg;
    export procedure executeScriptTask()()
    begin
      var label:=_ebx.workflow.label;
      var englishLabel:=msg.toString(label,locale.of('en','EN'));
      var frenchLabel:=msg.toString(label,locale.of('fr','FR'));
    end

Parameters :

userMessage: the user message.

locale: the locale. If null, the default locale is used.

Return :

the string message formatted with the specified locale or null if the input userMessage is null.

Can be used in: Script tasks, Table triggers, Function fields without search optimization

Documentation > Developer Guide > EBX® Script > API