com.google.javascript.jscomp
Class JsMessage

java.lang.Object
  extended by com.google.javascript.jscomp.JsMessage

public class JsMessage
extends Object

A representation of a translatable message in JavaScript source code.

Instances are created using a JsMessage.Builder, like this:

 JsMessage m = new JsMessage.Builder(key)
     .appendPart("Hi ")
     .appendPlaceholderReference("firstName")
     .appendPart("!")
     .setDesc("A welcome message")
     .build();
 


Nested Class Summary
static class JsMessage.Builder
          Contains functionality for creating js messages.
static interface JsMessage.IdGenerator
           
static class JsMessage.PlaceholderReference
          A reference to a placeholder in a translatable message.
static class JsMessage.Style
          Message style that could be used for JS code parsing.
 
Method Summary
 boolean equals(Object o)
           
 String getDesc()
          Gets the description associated with this message, intended to help translators, or null if this message has no description.
 String getId()
          Gets the message's id, or name (e.g.
 String getKey()
          Gets the message's key, or name (e.g.
 String getSourceName()
          Gets the message's sourceName.
 int hashCode()
           
 boolean isAnonymous()
           
 boolean isEmpty()
           
 boolean isExternal()
           
 boolean isHidden()
          Gets whether this message should be hidden from volunteer translators (to reduce the chances of a new feature leak).
 List<CharSequence> parts()
          Gets a read-only list of the parts of this message.
 Set<String> placeholders()
          Gets a read-only set of the registered placeholders in this message.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getSourceName

public String getSourceName()
Gets the message's sourceName.


getKey

public String getKey()
Gets the message's key, or name (e.g. "MSG_HELLO").


isAnonymous

public boolean isAnonymous()

isExternal

public boolean isExternal()

getId

public String getId()
Gets the message's id, or name (e.g. "92430284230902938293").


getDesc

public String getDesc()
Gets the description associated with this message, intended to help translators, or null if this message has no description.


isHidden

public boolean isHidden()
Gets whether this message should be hidden from volunteer translators (to reduce the chances of a new feature leak).


parts

public List<CharSequence> parts()
Gets a read-only list of the parts of this message. Each part is either a String or a JsMessage.PlaceholderReference.


placeholders

public Set<String> placeholders()
Gets a read-only set of the registered placeholders in this message.


toString

public String toString()
Overrides:
toString in class Object

isEmpty

public boolean isEmpty()
Returns:
false iff the message is represented by empty string.

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object