/**
* Build a {@code MessageBundle} from a {@code List} of {@code ExtractedMessage}s.
*/
public static MessageBundle bundleMessages(AlertSink alertSink,
List<ExtractedMessage> messages) {
MessageBundle messageBundle = new MessageBundle(PROJECT_ID, LANGUAGE_ID);
for (ExtractedMessage msg : messages) {
try {
messageBundle.addMessage(msg.getTcMessage());
} catch (InvalidMessageBundleException e) {
alertSink.add(new InvalidMessageError(msg.getSourcePosition(), e.getCause()));
}
}
return messageBundle;