public WritableMessageCatalog writeTo(final OutputStream out) {
return new WritableMessageCatalog() {
public void writeMessage(Message msg) throws IOException {
// TODO(jat): extract this to a common place
final StringBuilder buf = new StringBuilder();
msg.accept(new DefaultVisitor() {
@Override
public void visitNonlocalizableTextFragment(VisitorContext ctx,
NonlocalizableTextFragment fragment) {
buf.append(fragment.getText());
}