Fixed export bug.

This commit is contained in:
Mike Holly
2012-01-02 16:06:32 -08:00
parent 72e754a9db
commit 899c948784
4 changed files with 215 additions and 85 deletions

View File

@@ -26,7 +26,6 @@ PO.prototype.toString = function() {
this.comments.forEach(function(comment) {
lines.push('# ' + comment);
});
lines.push('');
}
lines.push('msgid ""');
@@ -182,22 +181,23 @@ PO.Item.prototype.toString = function() {
this.references.forEach(function(ref) {
lines.push(util.format('#: %s', ref));
});
['msgid', 'msgid_plural', 'msgstr'].forEach(function(keyword) {
var text = that[keyword];
if (text != null) {
if (util.isArray(text) && text.length > 1) {
text.forEach(function(t, i) {
lines = lines.concat(_process(keyword, t, i));
});
}
else {
text = util.isArray(text) ? text.join() : text;
lines = lines.concat(_process(keyword, text));
}
}
});
};
['msgid', 'msgid_plural', 'msgstr'].forEach(function(keyword) {
var text = that[keyword];
if (text != null) {
if (util.isArray(text) && text.length > 1) {
text.forEach(function(t, i) {
lines = lines.concat(_process(keyword, t, i));
});
}
else {
text = util.isArray(text) ? text.join() : text;
lines = lines.concat(_process(keyword, text));
}
}
});
return lines.join("\n");
};