Comparing version 0.2.4 to 0.2.5
@@ -123,6 +123,10 @@ var fs = require('fs'), | ||
} | ||
else if (line.match(/^#/)) { // Comment | ||
else if (line.match(/^#\s+/)) { // Translator comment | ||
finish(); | ||
item.comments.push(trim(line.replace(/^#/, ''))); | ||
item.comments.push(trim(line.replace(/^#\s+/, ''))); | ||
} | ||
else if (line.match(/^#\./)) { // Extracted comment | ||
finish(); | ||
item.extractedComments.push(trim(line.replace(/^#\./, ''))); | ||
} | ||
else if (line.match(/^msgid_plural/)) { // Plural form | ||
@@ -172,3 +176,4 @@ item.msgid_plural = extract(line); | ||
this.msgstr = []; | ||
this.comments = []; | ||
this.comments = []; // translator comments | ||
this.extractedComments = []; | ||
this.flags = {}; | ||
@@ -197,2 +202,17 @@ }; | ||
// https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html | ||
// says order is translator-comments, extracted-comments, references, flags | ||
if (this.comments.length > 0) { | ||
this.comments.forEach(function (c) { | ||
lines.push('# ' + c); | ||
}); | ||
} | ||
if (this.extractedComments.length > 0) { | ||
this.extractedComments.forEach(function (c) { | ||
lines.push('#. ' + c); | ||
}); | ||
} | ||
if (this.references.length > 0) { | ||
@@ -199,0 +219,0 @@ this.references.forEach(function (ref) { |
{ | ||
"name": "pofile", | ||
"description": "Parse and serialize Gettext PO files.", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"author": { | ||
@@ -11,2 +11,3 @@ "name": "Ruben Vermeersch", | ||
"contributors": [ | ||
"Julian Bäume", | ||
"Mike Holly" | ||
@@ -28,3 +29,4 @@ ], | ||
"scripts": { | ||
"test": "grunt test" | ||
"test": "grunt test", | ||
"prepublish": "grunt build" | ||
}, | ||
@@ -31,0 +33,0 @@ "directories": { |
@@ -91,7 +91,8 @@ # pofile - gettext .po parsing for JavaScript | ||
* `references`: An array of reference strings. | ||
* `comments`: An array of string comments. | ||
* `comments`: An array of string translator comments. | ||
* `extractedComments`: An array of string extracted comments. | ||
* `flags`: A dictionary of the string flags. Each flag is mapped to a key with | ||
value true. For instance, a string with the fuzzy flag set will have | ||
`item.flags.fuzzy == true`. | ||
* `msgctxt`: context of the message, an arbitrary string, can be used for disambiguation | ||
* `msgctxt`: Context of the message, an arbitrary string, can be used for disambiguation. | ||
@@ -98,0 +99,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13616
214
166