po2json
Advanced tools
Comparing version 0.4.2 to 0.4.3
@@ -20,3 +20,3 @@ { | ||
], | ||
"license": "GPL" | ||
"license": "LGPL" | ||
} |
@@ -35,2 +35,3 @@ /** | ||
var translations = parsed.translations[context]; | ||
var pluralForms = parsed.headers['plural-forms']; | ||
@@ -46,3 +47,8 @@ Object.keys(translations).forEach(function (key, i) { | ||
} else { | ||
result[translationKey] = [ t.msgid_plural ? t.msgid_plural : null ].concat(t.msgstr); | ||
if(pluralForms == 'nplurals=1; plural=0;') { | ||
msgstr = t.msgid_plural ? [t.msgstr] : t.msgstr | ||
result[translationKey] = [ t.msgid_plural ? t.msgid_plural : null ].concat(msgstr); | ||
} else { | ||
result[translationKey] = [ t.msgid_plural ? t.msgid_plural : null ].concat(t.msgstr); | ||
} | ||
} | ||
@@ -49,0 +55,0 @@ } |
{ | ||
"name": "po2json", | ||
"description": "Convert PO files to JSON", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"homepage": "https://github.com/mikeedwards/po2json", | ||
@@ -33,2 +33,5 @@ "author": { | ||
"name": "Szigetvári Áron" | ||
}, | ||
{ | ||
"name": "rafalt-iRonin" | ||
} | ||
@@ -35,0 +38,0 @@ ], |
@@ -118,2 +118,7 @@ # po2json | ||
### Running tests | ||
``` | ||
npm test | ||
``` | ||
## Contributing | ||
@@ -120,0 +125,0 @@ In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt](https://github.com/gruntjs/grunt). |
@@ -117,1 +117,15 @@ var po2json = require(".."), | ||
} | ||
module.exports["parse with Plural-Forms == nplurals=1; plural=0;"] = { | ||
setUp: function(callback){ | ||
this.po = fs.readFileSync(__dirname + "/fixtures/ja.po"); | ||
this.json = JSON.parse(fs.readFileSync(__dirname + "/fixtures/ja.json", "utf-8")); | ||
callback(); | ||
}, | ||
parse: function(test){ | ||
var parsed = po2json.parse(this.po); | ||
test.deepEqual(parsed, this.json); | ||
test.done(); | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
32732
25
445
212