Added toString method for PO

This commit is contained in:
Mike Holly 2012-01-01 17:02:19 -08:00
parent 1bae2deab0
commit ea1fcd870f

View File

@ -7,6 +7,13 @@ var PO = function() {
};
PO.prototype.save = function(filename, callback) {
fs.writeFile(filename, this.toString(), function(err){
if (err) throw err;
callback && callback();
})
};
PO.prototype.toString = function() {
var lines = ['msgid ""', 'msgstr ""']
, that = this;
@ -22,10 +29,7 @@ PO.prototype.save = function(filename, callback) {
lines.push('');
});
fs.writeFile(filename, lines.join("\n"), function(err){
if (err) throw err;
callback && callback();
})
return lines.join("\n");
};
PO.load = function(filename, callback) {