Package com.google.javascript.jscomp
Class JsMessage
java.lang.Object
com.google.javascript.jscomp.JsMessage
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
Modifier and TypeClassDescriptionstatic class
Contains functionality for creating JS messages.static interface
static class
A reference to a placeholder in a translatable message.static enum
Message style that could be used for JS code parsing. -
Method Summary
Modifier and TypeMethodDescriptionboolean
getDesc()
Gets the description associated with this message, intended to help translators, or null if this message has no description.getId()
Gets the message's id, or name (e.g.getKey()
Gets the message's key, or name (e.g.Gets the message's sourceName.int
hashCode()
boolean
boolean
isEmpty()
boolean
boolean
isHidden()
Gets whether this message should be hidden from volunteer translators (to reduce the chances of a new feature leak).parts()
Gets a read-only list of the parts of this message.Gets a read-only set of the registered placeholders in this message.toString()
-
Method Details
-
getSourceName
Gets the message's sourceName. -
getKey
Gets the message's key, or name (e.g."MSG_HELLO"
). -
isAnonymous
public boolean isAnonymous() -
isExternal
public boolean isExternal() -
getId
Gets the message's id, or name (e.g."92430284230902938293"
). -
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
Gets a read-only list of the parts of this message. Each part is either aString
or aJsMessage.PlaceholderReference
. -
placeholders
Gets a read-only set of the registered placeholders in this message. -
toString
-
isEmpty
public boolean isEmpty()- Returns:
- false iff the message is represented by empty string.
-
equals
-
hashCode
public int hashCode()
-