@GwtIncompatible(value="Currently not used in GWT version") public final class XtbMessageBundle extends java.lang.Object implements MessageBundle
Modifier and Type | Class and Description |
---|---|
private class |
XtbMessageBundle.Handler
A
ContentHandler that creates a JsMessage for each message
parsed from an XML Translation Bundle (XTB) file. |
private static class |
XtbMessageBundle.SecureEntityResolver
A secure EntityResolver that returns an empty string in response to
any attempt to resolve an external entity.
|
Modifier and Type | Field and Description |
---|---|
private JsMessage.IdGenerator |
idGenerator |
private java.util.Map<java.lang.String,JsMessage> |
messages |
private static XtbMessageBundle.SecureEntityResolver |
NOOP_RESOLVER |
Constructor and Description |
---|
XtbMessageBundle(java.io.InputStream xtb,
java.lang.String projectId)
Creates an instance and initializes it with the messages in an XTB file.
|
XtbMessageBundle(java.io.InputStream xtb,
java.lang.String projectId,
boolean unused) |
Modifier and Type | Method and Description |
---|---|
private static javax.xml.parsers.SAXParser |
createSAXParser() |
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.
|
private static final XtbMessageBundle.SecureEntityResolver NOOP_RESOLVER
private final java.util.Map<java.lang.String,JsMessage> messages
private final JsMessage.IdGenerator idGenerator
public XtbMessageBundle(java.io.InputStream xtb, @Nullable java.lang.String projectId, boolean unused)
public XtbMessageBundle(java.io.InputStream xtb, @Nullable java.lang.String projectId)
xtb
- the XTB file as a byte streamprojectId
- the translation console project id (i.e. name)private static javax.xml.parsers.SAXParser createSAXParser() throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
public JsMessage getMessage(java.lang.String id)
MessageBundle
getMessage
in interface MessageBundle
id
- the id of the message being replaced; the key is message ID
generated by JsMessage.IdGenerator
public JsMessage.IdGenerator idGenerator()
MessageBundle
idGenerator
in interface MessageBundle
public java.lang.Iterable<JsMessage> getAllMessages()
MessageBundle
getAllMessages
in interface MessageBundle