Added toString method for PO
This commit is contained in:
12
lib/po.js
12
lib/po.js
@@ -7,6 +7,13 @@ var PO = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
PO.prototype.save = function(filename, callback) {
|
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 ""']
|
var lines = ['msgid ""', 'msgstr ""']
|
||||||
, that = this;
|
, that = this;
|
||||||
|
|
||||||
@@ -22,10 +29,7 @@ PO.prototype.save = function(filename, callback) {
|
|||||||
lines.push('');
|
lines.push('');
|
||||||
});
|
});
|
||||||
|
|
||||||
fs.writeFile(filename, lines.join("\n"), function(err){
|
return lines.join("\n");
|
||||||
if (err) throw err;
|
|
||||||
callback && callback();
|
|
||||||
})
|
|
||||||
};
|
};
|
||||||
|
|
||||||
PO.load = function(filename, callback) {
|
PO.load = function(filename, callback) {
|
||||||
|
|||||||
Reference in New Issue
Block a user