Class MessageTranslator<D>

All Implemented Interfaces:
MessageReceiver<SimpleMessage<D>>

public class MessageTranslator<D> extends MessagePasser<SimpleMessage<D>>
Translates the text of the message and all embedded sub-structures. The text object and all PreMessage type objects contained in the arguments are translages. Arguments of type String are not translated. For translation, they must be wrapped by PreMessage.preMessage(String,Object...)
  • Field Details

  • Constructor Details

    • MessageTranslator

      public MessageTranslator()
    • MessageTranslator

      public MessageTranslator(MessageReceiver<SimpleMessage<D>> rec, CatalogByString catalog, String... langs)
      Constructor which sets all parameters.
      Parameters:
      rec - drain to which messages will be sent,
      catalog - of translations
      langs - language preferences
    • MessageTranslator

      public MessageTranslator(MessageReceiver<SimpleMessage<D>> rec, CatalogByString catalog, List<String> langs)
      Constructor which sets all parameters.
      Parameters:
      rec - drain to which messages will be sent,
      catalog - of translations
      langs - language preferences
  • Method Details

    • setPreferences

      public void setPreferences(List<String> list)
      Evident
    • setPreferences

      public void setPreferences(String... list)
      Evident
    • setCatalog

      public void setCatalog(CatalogByString cat)
      Evident
    • receive

      public void receive(SimpleMessage<D> m)
      Translates the text of the message and passes it to the current drain. For the translation @see process(SimpleMessage)
      Specified by:
      receive in interface MessageReceiver<D>
      Overrides:
      receive in class MessagePasser<SimpleMessage<D>>
      Parameters:
      m - the message to receive.
    • process

      public SimpleMessage<D> process(SimpleMessage<D> msg)
      Returns a new message with all texts translated, including all embedded.