Socket
Socket
Sign inDemoInstall

i18next-conv

Package Overview
Dependencies
4
Maintainers
2
Versions
68
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.6 to 0.1.7

50

lib/gettextWrapper.js

@@ -86,3 +86,5 @@ var Gettext = require("node-gettext")

var data = path.extname(target) === '.po' ? gt.compilePO(domain) : gt.compileMO(domain);
callback(err, data);
if (typeof callback === 'function') {
callback(err, data);
}
});

@@ -100,3 +102,5 @@ });

if(err) {
callback(err);
if (typeof callback === 'function') {
callback(err);
}
return;

@@ -106,4 +110,5 @@ }

var flat = flatten.flatten(JSON.parse(body), options);
callback(null, flat);
if (typeof callback === 'function') {
callback(null, flat);
}
});

@@ -142,4 +147,5 @@ },

}
callback(null, gt);
if (typeof callback === 'function') {
callback(null, gt);
}
},

@@ -222,3 +228,5 @@

var jsonData = JSON.stringify(json, null, 4);
callback(err, jsonData);
if (typeof callback === 'function') {
callback(err, jsonData);
}
});

@@ -232,7 +240,10 @@ });

addTextDomain: function(domain, source, options, callback) {
if (!options.quiet) console.log(('\n --> reading file from: ' + source));
if (!options.quiet) console.log(('\n --> reading file from: ' + source));
fs.readFile(source, function(err, body) {
if(err) {
callback(err);
if (typeof callback === 'function') {
callback(err);
}
return;

@@ -243,7 +254,9 @@ }

if (options.filter) {
options.filter(gt, domain, callback);
} else {
callback(null, gt._domains[domain]._translationTable);
}
if (options.filter) {
options.filter(gt, domain, callback);
} else {
if (typeof callback === 'function'){
callback(null, gt._domains[domain]._translationTable);
}
}
});

@@ -308,4 +321,5 @@ },

}
callback(null, json);
if (typeof callback === 'function'){
callback(null, json);
}
},

@@ -356,5 +370,7 @@

fs.writeFile(target, data, function(err) {
callback(err);
if (typeof callback === 'function') {
callback(err);
}
});
}
};

@@ -9,3 +9,3 @@ {

],
"version": "0.1.6",
"version": "0.1.7",
"private": false,

@@ -12,0 +12,0 @@ "preferGlobal": "true",

@@ -84,2 +84,16 @@ # Introduction

## convert i18next json to .mo or .po with node
```
var path = require('path');
var source = path.resolve(__dirname, '../locales/ua-UK/translation.json');
var target = path.resolve(__dirname, '../locales/ua-UK/translation.mo');
var options = {quiet : true};
var callback = () => {console.log('Translation ua-UK done');}
converter.i18nextToGettext('ua-UK', source, target, options, callback);
```
# All credits go to

@@ -86,0 +100,0 @@

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc