Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

i18next-conv

Package Overview
Dependencies
Maintainers
2
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

i18next-conv - npm Package Compare versions

Comparing version 2.5.0 to 2.6.0

test/_testfiles/de/translation.utf8_msgid_not_fully_translated.json

6

lib/gettextWrapper.js

@@ -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)

2

package.json

@@ -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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc