i18next-conv
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -58,7 +58,7 @@ var Gettext = require("node-gettext") | ||
self.parseGettext(domain, flat, function(err, gt) { | ||
self.parseGettext(domain, flat, options, function(err, gt) { | ||
var data = path.extname(target) === '.po' ? gt.compilePO(domain) : gt.compileMO(domain); | ||
self.writeFile(target, data, callback); | ||
self.writeFile(target, data, options, callback); | ||
}); | ||
@@ -74,3 +74,4 @@ }); | ||
console.log(('\n --> reading file from: ' + source)); | ||
if (!options.quiet) console.log(('\n --> reading file from: ' + source)); | ||
fs.readFile(source, function(err, body) { | ||
@@ -91,3 +92,3 @@ if(err) { | ||
*/ | ||
parseGettext: function(domain, data, callback) { | ||
parseGettext: function(domain, data, options, callback) { | ||
var gt = new Gettext(); | ||
@@ -98,3 +99,3 @@ gt.addTextdomain(domain, ''); | ||
console.log('\n <-> parsing data to gettext format'.cyan); | ||
if (!options.quiet) console.log('\n <-> parsing data to gettext format'.cyan); | ||
@@ -186,3 +187,3 @@ for (var m in data) { | ||
self.addTextDomain(domain, source, function(err, data) { | ||
self.addTextDomain(domain, source, options, function(err, data) { | ||
// console.log(data); | ||
@@ -194,3 +195,3 @@ | ||
self.writeFile(target, jsonData, callback); | ||
self.writeFile(target, jsonData, options, callback); | ||
}); | ||
@@ -203,6 +204,7 @@ }); | ||
*/ | ||
addTextDomain: function(domain, source, callback) { | ||
addTextDomain: function(domain, source, options, callback) { | ||
var self = this; | ||
console.log(('\n --> reading file from: ' + source)); | ||
if (!options.quiet) console.log(('\n --> reading file from: ' + source)); | ||
fs.readFile(source, function(err, body) { | ||
@@ -321,5 +323,5 @@ if(err) { | ||
***************************/ | ||
writeFile: function(target, data, callback) { | ||
writeFile: function(target, data, options, callback) { | ||
console.log(('\n <-- writting file to: ' + target)); | ||
if (!options.quiet) console.log(('\n <-- writting file to: ' + target)); | ||
fs.writeFile(target, data, function(err) { | ||
@@ -331,2 +333,2 @@ callback(err); | ||
}; | ||
}; |
@@ -6,3 +6,3 @@ { | ||
, "keywords": ["i18next", "gettext"] | ||
, "version": "0.1.1" | ||
, "version": "0.1.2" | ||
, "private": false | ||
@@ -9,0 +9,0 @@ , "preferGlobal": "true" |
@@ -26,15 +26,17 @@ #!/usr/bin/env node | ||
.option('-ks, --keyseparator [path]', 'Specify keyseparator you want to use, defaults to ##', '##') | ||
.option('--quiet', 'Silence output', false) | ||
.parse(process.argv); | ||
if (program.source && program.language) { | ||
console.log('\nstart converting'.yellow); | ||
var options = { | ||
keyseparator: program.keyseparator | ||
keyseparator: program.keyseparator, | ||
quiet: program.quiet | ||
}; | ||
if (!options.quiet) console.log('\nstart converting'.yellow); | ||
converter.process(program.language, program.source, program.target, options, function(err) { | ||
if (err) { | ||
console.log('\nfailed writing file\n\n'.red); | ||
} else { | ||
} else if (!options.quiet) { | ||
console.log('\nfile written\n\n'.green); | ||
@@ -41,0 +43,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
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
112249
2584