Class StringMessageTranslator

StringMessageTranslator class

Description

Translates a string message to an object

Example

const stringMessageTranslator = new StringMessageTranslator();
const translatedMessage = stringMessageTranslator.translate('Hello World!');
// translatedMessage = {
// content: 'Hello World!',
// metadata: {}
// }

See

AbstractMessageTranslator

Hierarchy

Constructors

Methods

Constructors

Methods

  • Translate a given message to an appropriate format to message processing This method should return a object instance with two keys: content and metadata. The content should contain the translated message and, metadata a object with translation metadata or an empty json object.

    Returns

    • Translated message

    Memberof

    StringMessageTranslator

    Parameters

    • message: string

      Message to be translated

    Returns object

  • Translate a given message to an appropriate format to message processing This method should return a object instance with two keys: content and metadata. The content should contain the translated message and, metadata a object with translation metadata or an empty json object.

    Returns

    • Translated message

    Memberof

    AbstractMessageTranslator

    Parameters

    • message: any

      Message to be translated

    • Rest ...args: any

      Additional arguments to be used by the translator

    Returns MessageTranslatorOutput