i18next-conv
Advanced tools
Comparing version 2.5.0 to 2.6.0
@@ -296,2 +296,8 @@ var Gettext = require("node-gettext") | ||
data[ctxt][id] = x; | ||
if (x.msgstr[0] === '') | ||
x.msgstr[0] = x.msgid; | ||
for (var i = 1; i < x.msgstr.length; i++) { | ||
if (x.msgstr[i] === '') | ||
x.msgstr[i] = x.msgid_plural; | ||
} | ||
x.msgid = id; | ||
@@ -298,0 +304,0 @@ if (id !== key) |
@@ -9,3 +9,3 @@ { | ||
], | ||
"version": "2.5.0", | ||
"version": "2.6.0", | ||
"private": false, | ||
@@ -12,0 +12,0 @@ "preferGlobal": "true", |
@@ -31,2 +31,4 @@ var fs = require('fs') | ||
utf8_msgid_expected: './test/_testfiles/de/translation.utf8_msgid.json', | ||
utf8_msgid_not_fully_translated: './test/_testfiles/de/translation.utf8_msgid_not_fully_translated.po', | ||
utf8_msgid_not_fully_translated_expected: './test/_testfiles/de/translation.utf8_msgid_not_fully_translated.json' | ||
}, | ||
@@ -38,3 +40,5 @@ | ||
utf8_2: './test/_testfiles/ru/translation2.utf8.po', | ||
utf8_2_expected: './test/_testfiles/ru/translation2.utf8.json' | ||
utf8_2_expected: './test/_testfiles/ru/translation2.utf8.json', | ||
utf8_msgid_not_fully_translated: './test/_testfiles/ru/translation.utf8_msgid_not_fully_translated.po', | ||
utf8_msgid_not_fully_translated_expected: './test/_testfiles/ru/translation.utf8_msgid_not_fully_translated.json' | ||
} | ||
@@ -226,2 +230,30 @@ }; | ||
it('should fill in the original English strings if missing - convert a utf8 PO file with msgid as original string to a JSON file', function(done) { | ||
var tests = []; | ||
// DE | ||
tests.push(function(next) { | ||
var output = './test/_tmp/de_utf8_msgid_not_fully_translated.json'; | ||
wrapper.gettextToI18next('de', testFiles.de.utf8_msgid_not_fully_translated, output, {quiet: true, splitNewLine: true, keyasareference: true}, function() { | ||
var result = require(path.join('..', output)); | ||
var expected = require(path.join('..', testFiles.de.utf8_msgid_not_fully_translated_expected)); | ||
expect(result).to.deep.equal(expected); | ||
fs.unlinkSync(output); | ||
next(); | ||
}); | ||
}); | ||
// RU | ||
tests.push(function(next) { | ||
var output = './test/_tmp/ru_utf8_msgid_not_fully_translated.json'; | ||
wrapper.gettextToI18next('ru', testFiles.ru.utf8_msgid_not_fully_translated, output, {quiet: true, splitNewLine: true, keyasareference: true}, function() { | ||
var result = require(path.join('..', output)); | ||
var expected = require(path.join('..', testFiles.ru.utf8_msgid_not_fully_translated_expected)); | ||
expect(result).to.deep.equal(expected); | ||
fs.unlinkSync(output); | ||
next(); | ||
}); | ||
}); | ||
async.series(tests, done); | ||
}); | ||
// -- Error States & Invalid Data -- | ||
@@ -228,0 +260,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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
128544
40
3003
1
31