add parsing support for msgctxt field of poitems

The gettext format specifies a msgctxt field for translated items. An
example of how to use this field has been added to the tests and the
parsing of this attribute has been implemented.
This commit is contained in:
Julian Bäume
2014-01-21 13:44:52 +01:00
parent 94ad44f953
commit 6790bfb466
3 changed files with 27 additions and 1 deletions

View File

@@ -139,6 +139,10 @@ PO.parse = function (data) {
item.msgstr[plural] = extract(line);
context = 'msgstr';
}
else if (line.match(/^msgctxt/)) { // Context
finish();
item.msgctxt = extract(line);
}
else { // Probably multiline string or blank
if (line.length > 0) {
if (context === 'msgstr') {
@@ -160,6 +164,7 @@ PO.parse = function (data) {
PO.Item = function () {
this.msgid = '';
this.msgctxt = '';
this.references = [];
this.msgid_plural = null;
this.msgstr = [];