// args[0]: project name
// args[1]: file name
public static void main(String[] args) throws IOException
{
JsMessageExtractor extractor = new JsMessageExtractor(new GoogleJsMessageIdGenerator(args[0]), JsMessage.Style.CLOSURE);
Collection<JsMessage> messages = extractor.extractMessages(SourceFile.fromFile(args[1]));
for (JsMessage message : messages) {
System.out.println("<translation id=\"" + message.getId() + "\">" + message.toString() + "</translation>");
}
}
You'll need to add the <translationbundle> wrapper, set the output encoding, and escape the message for serious usage. Placeholders not included (but see JsMessage.java if you want to implement support)