lib/qx/tool/compiler/app/Translation.js
function(filename, cb) {
      var t = this;
      var lines = [];
      
      function write(key, value) {
        if (value === undefined || value === null) {
          return;
        }
        value = value.replace(/\t/g, "\\t").replace(/\r/g, "\\r")
          .replace(/\n/g, "\\n")
          .replace(/"/g, "\\\"");
        lines.push(key + " \"" + value + "\"");
      }
      
      for (var msgid in t.__translations) {
        var entry = t.__translations[msgid];
        if (entry.comments) {
          if (entry.comments.translator) {
            lines.push("# " + entry.comments.translator);
          }
          if (entry.comments.extracted) {
            lines.push("#. " + entry.comments.extracted); 
          }
          if (entry.comments.reference) {
            let refStr = "#:";
            const ref = entry.comments.reference;
            for (let classname in ref) {
              if (ref[classname]) {
                for (let lineNo of ref[classname]) {
                  const addStr = " " + classname + ":" + lineNo;
                  if (refStr.length + addStr.length > 78) { // 78 is default length in python po library
                    // line break
                    lines.push(refStr);
                    refStr = "#:" + addStr;
                  } else {
                    refStr += addStr;
                  }
                }
              }
            }
            if (refStr.length > 3) { // write remaining refStr
              lines.push(refStr);
            }
          }
          if (entry.comments.flags) {
            lines.push("#, " + entry.comments.flags.join(",")); 
          }
        } else {
          lines.push("#");
        }
        if (entry.msgctxt) {
          lines.push("msgctxt \"" + entry.msgctxt + "\""); 
        }
        write("msgid", entry.msgid);
        write("msgid_plural", entry.msgid_plural);
        if (qx.lang.Type.isArray(entry.msgstr)) {
          entry.msgstr.forEach(function(value, index) {
            write("msgstr[" + index + "]", value);
          });
        } else if (entry.msgid_plural) {
          write("msgstr[0]", "");
          write("msgstr[1]", "");
        } else {
          write("msgstr", entry.msgstr || "");
        }
        lines.push("");
      }
      var data = lines.join("\n");
      return qx.tool.compiler.utils.Promisify.fs.writeFileAsync(filename, data, { encoding: "utf8" });
    }
function(filename, cb) {
      var t = this;
      var lines = [];
      
      function write(key, value) {
        if (value === undefined || value === null) {
          return;
        }
        value = value.replace(/\t/g, "\\t").replace(/\r/g, "\\r")
          .replace(/\n/g, "\\n")
          .replace(/"/g, "\\\"");
        lines.push(key + " \"" + value + "\"");
      }
      
      for (var msgid in t.__translations) {
        var entry = t.__translations[msgid];
        if (entry.comments) {
          if (entry.comments.translator) {
            lines.push("# " + entry.comments.translator);
          }
          if (entry.comments.extracted) {
            lines.push("#. " + entry.comments.extracted); 
          }
          if (entry.comments.reference) {
            let refStr = "#:";
            const ref = entry.comments.reference;
            for (let classname in ref) {
              if (ref[classname]) {
                for (let lineNo of ref[classname]) {
                  const addStr = " " + classname + ":" + lineNo;
                  if (refStr.length + addStr.length > 78) { // 78 is default length in python po library
                    // line break
                    lines.push(refStr);
                    refStr = "#:" + addStr;
                  } else {
                    refStr += addStr;
                  }
                }
              }
            }
            if (refStr.length > 3) { // write remaining refStr
              lines.push(refStr);
            }
          }
          if (entry.comments.flags) {
            lines.push("#, " + entry.comments.flags.join(",")); 
          }
        } else {
          lines.push("#");
        }
        if (entry.msgctxt) {
          lines.push("msgctxt \"" + entry.msgctxt + "\""); 
        }
        write("msgid", entry.msgid);
        write("msgid_plural", entry.msgid_plural);
        if (qx.lang.Type.isArray(entry.msgstr)) {
          entry.msgstr.forEach(function(value, index) {
            write("msgstr[" + index + "]", value);
          });
        } else if (entry.msgid_plural) {
          write("msgstr[0]", "");
          write("msgstr[1]", "");
        } else {
          write("msgstr", entry.msgstr || "");
        }
        lines.push("");
      }
      var data = lines.join("\n");
      return qx.tool.compiler.utils.Promisify.fs.writeFileAsync(filename, data, { encoding: "utf8" });
    }
Writes the .po file to a specific filename
@param filename {String}