implement writing msgctxt field
since the parser can extract this information, now, the writer should also be able to write it back to a po file
This commit is contained in:
parent
6790bfb466
commit
c046b62873
@ -203,7 +203,7 @@ PO.Item.prototype.toString = function () {
|
|||||||
lines.push('#, ' + flags.join(","));
|
lines.push('#, ' + flags.join(","));
|
||||||
}
|
}
|
||||||
|
|
||||||
['msgid', 'msgid_plural', 'msgstr'].forEach(function (keyword) {
|
['msgctxt', 'msgid', 'msgid_plural', 'msgstr'].forEach(function (keyword) {
|
||||||
var text = that[keyword];
|
var text = that[keyword];
|
||||||
if (text != null) {
|
if (text != null) {
|
||||||
if (isArray(text) && text.length > 1) {
|
if (isArray(text) && text.length > 1) {
|
||||||
|
@ -37,4 +37,11 @@ describe('Write', function () {
|
|||||||
var str = po.toString();
|
var str = po.toString();
|
||||||
assertHasLine(str, "msgstr \"Source\"");
|
assertHasLine(str, "msgstr \"Source\"");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('write msgctxt', function () {
|
||||||
|
var input = fs.readFileSync(__dirname + '/fixtures/big.po', 'utf8');
|
||||||
|
var po = PO.parse(input);
|
||||||
|
var str = po.toString();
|
||||||
|
assertHasLine(str, 'msgctxt "folder action"');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user