Package com.google.javascript.jscomp
Class JsMessage.Builder
java.lang.Object
com.google.javascript.jscomp.JsMessage.Builder
- Enclosing class:
- JsMessage
Contains functionality for creating JS messages. Generates authoritative
keys and fingerprints for a message that must stay constant over time.
This implementation correctly processes unnamed messages and creates a key
for them that looks like MSG_.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAppends a placeholder reference to the messageappendStringPart
(String part) Appends a translatable string literal to the message.build()
build
(JsMessage.IdGenerator idGenerator) getKey()
Gets the message's key (e.g.getParts()
Returns the message registered placeholdersboolean
hasParts()
Gets whether at least one part has been appended.Sets the description of the message, which helps translators.setIsHidden
(boolean hidden) Sets whether the message should be hidden from volunteer translators.setMeaning
(String meaning) Sets the programmer-specified meaning of this message, which forces this message to translate differently.setSourceName
(String sourceName)
-
Constructor Details
-
Builder
public Builder() -
Builder
Creates an instance.
-
-
Method Details
-
getKey
Gets the message's key (e.g."MSG_HELLO"
). -
setKey
- Parameters:
key
- a key that should uniquely identify this message; typically it is the message's name (e.g."MSG_HELLO"
).
-
setSourceName
- Parameters:
sourceName
- The message's sourceName.
-
appendPlaceholderReference
Appends a placeholder reference to the message -
appendStringPart
Appends a translatable string literal to the message. -
getPlaceholders
Returns the message registered placeholders -
setDesc
Sets the description of the message, which helps translators. -
setMeaning
Sets the programmer-specified meaning of this message, which forces this message to translate differently. -
setIsHidden
Sets whether the message should be hidden from volunteer translators. -
hasParts
public boolean hasParts()Gets whether at least one part has been appended. -
getParts
-
build
-
build
-