[Pkg-javascript-commits] [node-po2json] 01/03: New upstream version 0.4.5
Mathias Behrle
mbehrle at moszumanska.debian.org
Fri Nov 4 16:33:55 UTC 2016
This is an automated email from the git hooks/post-receive script.
mbehrle pushed a commit to branch master
in repository node-po2json.
commit 6492e3b960ed97f7a07f223006fa38fb109a8712
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Fri Nov 4 17:29:11 2016 +0100
New upstream version 0.4.5
---
lib/parse.js | 2 ++
package.json | 2 +-
test/fixtures/ja-jed1.x.json | 1 +
test/fixtures/ja.json | 3 ++-
test/fixtures/ja.po | 5 +++++
test/po2json_test.js | 14 ++++++++++++++
6 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/lib/parse.js b/lib/parse.js
index 06139b2..5cb1f6a 100644
--- a/lib/parse.js
+++ b/lib/parse.js
@@ -42,6 +42,8 @@ module.exports = function(buffer, options) {
if (!fuzzy || options.fuzzy) {
if (options.format === 'mf') {
result[translationKey] = t.msgstr[0];
+ } else if (options.format === 'jed1.x') {
+ result[translationKey] = [ t.msgid_plural ? t.msgid_plural : null ].concat(t.msgstr);
} else {
if(pluralForms == 'nplurals=1; plural=0;') {
msgstr = t.msgid_plural ? [t.msgstr] : t.msgstr
diff --git a/package.json b/package.json
index 3645a5d..b625116 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "po2json",
"description": "Convert PO files to JSON",
- "version": "0.4.4",
+ "version": "0.4.5",
"homepage": "https://github.com/mikeedwards/po2json",
"author": {
"name": "Joshua I. Miller",
diff --git a/test/fixtures/ja-jed1.x.json b/test/fixtures/ja-jed1.x.json
new file mode 100644
index 0000000..8803416
--- /dev/null
+++ b/test/fixtures/ja-jed1.x.json
@@ -0,0 +1 @@
+{"domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural_forms":"nplurals=1; plural=0;","lang":"ja"},"♂ Male":["男性"],"partner application":["パートナーアプリ"],"result":["検索結果"],"For %s person starting at %s":["For %1$s people starting at %2$s"]}}}
diff --git a/test/fixtures/ja.json b/test/fixtures/ja.json
index 35f2cdc..a562b06 100644
--- a/test/fixtures/ja.json
+++ b/test/fixtures/ja.json
@@ -12,5 +12,6 @@
},
"♂ Male": [ null, "男性" ],
"partner application": [ "partner applications", [ "パートナーアプリ" ] ],
- "result": [ "results", [ "検索結果" ] ]
+ "result": [ "results", [ "検索結果" ] ],
+ "For %s person starting at %s": [ "For %s people starting at %s", ["For %1$s people starting at %2$s"] ]
}
diff --git a/test/fixtures/ja.po b/test/fixtures/ja.po
index 3310fa9..e590422 100755
--- a/test/fixtures/ja.po
+++ b/test/fixtures/ja.po
@@ -20,3 +20,8 @@ msgstr[0] "パートナーアプリ"
msgid "result"
msgid_plural "results"
msgstr[0] "検索結果"
+
+msgid "For %s person starting at %s"
+msgid_plural "For %s people starting at %s"
+msgstr[0] "For %1$s people starting at %2$s"
+
diff --git a/test/po2json_test.js b/test/po2json_test.js
index 1838527..4239749 100644
--- a/test/po2json_test.js
+++ b/test/po2json_test.js
@@ -129,6 +129,20 @@ module.exports["parse with Plural-Forms == nplurals=1; plural=0;"] = {
}
}
+module.exports["parse with Plural-Forms == nplurals=1; plural=0; and with Jed1.x format"] = {
+ setUp: function(callback){
+ this.po = fs.readFileSync(__dirname + "/fixtures/ja.po");
+ this.json = JSON.parse(fs.readFileSync(__dirname + "/fixtures/ja-jed1.x.json", "utf-8"));
+ callback();
+ },
+
+ parse: function(test){
+ var parsed = po2json.parse(this.po, { format: 'jed1.x' });
+ test.deepEqual(parsed, this.json);
+ test.done();
+ }
+}
+
module.exports["parse with no headers"] ={
setUp: function(callback){
this.po = fs.readFileSync(__dirname + "/fixtures/en-no-header.po");
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-po2json.git
More information about the Pkg-javascript-commits
mailing list