Package eu.bandm.tools.muli
Class MessageTranslator<D>
- All Implemented Interfaces:
MessageReceiver<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 Summary
FieldsModifier and TypeFieldDescriptionprotected CatalogByStringCatalogByStringfor the translations.static final Catalog<Message.Kind> Preference list of languages into which to translage.Fields inherited from class eu.bandm.tools.message.SingleSender
receiver -
Constructor Summary
ConstructorsConstructorDescriptionMessageTranslator(MessageReceiver<SimpleMessage<D>> rec, CatalogByString catalog, String... langs) Constructor which sets all parameters.MessageTranslator(MessageReceiver<SimpleMessage<D>> rec, CatalogByString catalog, List<String> langs) Constructor which sets all parameters. -
Method Summary
Modifier and TypeMethodDescriptionprocess(SimpleMessage<D> msg) Returns a new message with all texts translated, including all embedded.voidreceive(SimpleMessage<D> m) Translates the text of the message and passes it to the current drain.voidEvidentvoidsetPreferences(String... list) EvidentvoidsetPreferences(List<String> list) EvidentMethods inherited from class eu.bandm.tools.message.SingleSender
getReceiver, send, setReceiverMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface eu.bandm.tools.message.MessageReceiver
ifSubcriticalThen, ifSubcriticalThen, ifSubcriticalThenElse
-
Field Details
-
preferences
Preference list of languages into which to translage.- See Also:
-
catalog
CatalogByStringfor the translations. -
kindPrintName
-
-
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 translationslangs- 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 translationslangs- language preferences
-
-
Method Details
-
setPreferences
Evident -
setPreferences
Evident -
setCatalog
Evident -
receive
Translates the text of the message and passes it to the current drain. For the translation @see process(SimpleMessage)- Specified by:
receivein interfaceMessageReceiver<D>- Overrides:
receivein classMessagePasser<SimpleMessage<D>>- Parameters:
m- the message to receive.
-
process
Returns a new message with all texts translated, including all embedded.
-