Package com.google.javascript.jscomp
Class XtbMessageBundle
- java.lang.Object
-
- com.google.javascript.jscomp.XtbMessageBundle
-
- All Implemented Interfaces:
MessageBundle
@GwtIncompatible("Currently not used in GWT version") public final class XtbMessageBundle extends java.lang.Object implements MessageBundle
A MessageBundle that parses messages from an XML Translation Bundle (XTB) file. TODO(moz): Make this GWT compatible.
-
-
Constructor Summary
Constructors Constructor Description XtbMessageBundle(java.io.InputStream xtb, java.lang.String projectId)
Creates an instance and initializes it with the messages in an XTB file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Iterable<JsMessage>
getAllMessages()
Returns an iterable over the keys that this object has replacements for.JsMessage
getMessage(java.lang.String id)
Gets a message replacement.JsMessage.IdGenerator
idGenerator()
Gets the message ID generator to use to compute message IDs for this type of bundle.
-
-
-
Constructor Detail
-
XtbMessageBundle
public XtbMessageBundle(java.io.InputStream xtb, @Nullable java.lang.String projectId)
Creates an instance and initializes it with the messages in an XTB file.- Parameters:
xtb
- the XTB file as a byte streamprojectId
- the translation console project id (i.e. name)
-
-
Method Detail
-
getMessage
public JsMessage getMessage(java.lang.String id)
Description copied from interface:MessageBundle
Gets a message replacement.- Specified by:
getMessage
in interfaceMessageBundle
- Parameters:
id
- the id of the message being replaced; the key is message ID generated byJsMessage.IdGenerator
- Returns:
- the message replacement, which may be null.
-
idGenerator
public JsMessage.IdGenerator idGenerator()
Description copied from interface:MessageBundle
Gets the message ID generator to use to compute message IDs for this type of bundle.- Specified by:
idGenerator
in interfaceMessageBundle
- Returns:
- idGenerator instance or null if we do not want to use any custom id generation. In case if idGenerator is null caller should decide how to create id by itself. In the most cases using the message key is enough.
-
getAllMessages
public java.lang.Iterable<JsMessage> getAllMessages()
Description copied from interface:MessageBundle
Returns an iterable over the keys that this object has replacements for.- Specified by:
getAllMessages
in interfaceMessageBundle
- Returns:
- all messages from this bundle.
-
-