Package com.google.javascript.jscomp

# Class XtbMessageBundle

java.lang.Object
com.google.javascript.jscomp.XtbMessageBundle

All Implemented Interfaces:
  `MessageBundle`

public class XtbMessageBundle extends Object implements MessageBundle
A MessageBundle that parses messages from an XML Translation Bundle (XTB) file.

## Constructor Summary

Constructors
Constructor
Description
`XtbMessageBundle(InputStream xtb, String projectId)`
Creates an instance and initializes it with the messages in an XTB file.
`XtbMessageBundle(InputStream xtb, String projectId, boolean unused)`

## Method Summary

Modifier and Type
Method
Description
`Iterable<JsMessage>`
`getAllMessages()`
Returns an iterable over the keys that this object has replacements for.
`JsMessage`
`getMessage(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.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### XtbMessageBundle

public XtbMessageBundle(InputStream xtb, @Nullable String projectId, boolean unused)

### XtbMessageBundle

public XtbMessageBundle(InputStream xtb, @Nullable String projectId)
Creates an instance and initializes it with the messages in an XTB file.

Parameters:
  `xtb` - the XTB file as a byte stream
  `projectId` - the translation console project id (i.e. name)

## Method Details

### getMessage

public JsMessage getMessage(String id)
Description copied from interface: `MessageBundle`
Gets a message replacement.

Specified by:
  `getMessage` in interface `MessageBundle`
Parameters:
  `id` - the id of the message being replaced; the key is message ID generated by `JsMessage.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 interface `MessageBundle`
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 Iterable<JsMessage> getAllMessages()
Description copied from interface: `MessageBundle`
Returns an iterable over the keys that this object has replacements for.

Specified by:
  `getAllMessages` in interface `MessageBundle`
Returns:
  all messages from this bundle.