Class GoogleJsMessageIdGenerator

  • All Implemented Interfaces:
    JsMessage.IdGenerator

    public final class GoogleJsMessageIdGenerator
    extends java.lang.Object
    implements JsMessage.IdGenerator
    An JsMessage.IdGenerator designed to play nicely with Google's Translation systems. Each message is scoped to a project id, so that it does not conflict with other messages at Google.

    Just as reminder what key type used in different formats:

    1. XMB - id. We export using this format.
    2. XTB - id. Internal, result of translation.
    3. XLB - name. External, use it if we need to share translation with third part.
    4. PROPERTIES - name.
    See Also:
    xmb
    • Constructor Summary

      Constructors 
      Constructor Description
      GoogleJsMessageIdGenerator​(java.lang.String projectId)
      Creates an instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String generateId​(java.lang.String meaning, java.util.List<java.lang.CharSequence> messageParts)
      Generate the ID for the message.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GoogleJsMessageIdGenerator

        public GoogleJsMessageIdGenerator​(java.lang.String projectId)
        Creates an instance.
        Parameters:
        projectId - A TC project name (e.g. "MyProject")
    • Method Detail

      • generateId

        public java.lang.String generateId​(java.lang.String meaning,
                                           java.util.List<java.lang.CharSequence> messageParts)
        Description copied from interface: JsMessage.IdGenerator
        Generate the ID for the message. Messages with the same messageParts and meaning will get the same id. Messages with the same id will get the same translation.
        Specified by:
        generateId in interface JsMessage.IdGenerator
        Parameters:
        meaning - The programmer-specified meaning. If no @meaning annotation appears, we will use the name of the variable it's assigned to. If the variable is unnamed, then we will just use a fingerprint of the message.
        messageParts - The parts of the message, including the main message text.