void ensureNewlines(MessageFile mf) {
   for (MessageFile.Message m : mf.messages.values()) {
     MessageFile.Line l = m.firstLine;
     while (l.text.endsWith("\\")) l = l.next;
     if (l.next != null && !l.next.text.isEmpty()) l.insertAfter("");
   }
 }
 void sort(MessageFile mf, boolean includePrecedingNewlines) {
   for (MessageFile.Message m : mf.messages.values()) {
     for (MessageFile.Line l : m.getLines(includePrecedingNewlines)) {
       l.remove();
       mf.lastLine.insertAfter(l);
     }
   }
 }