Created
February 5, 2014 16:16
-
-
Save JumpLink/8827217 to your computer and use it in GitHub Desktop.
generates one json-file including all languages in all translations using https://github.com/staser written in node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// generates one json-file including all languages in all translations using https://github.com/staser | |
var fs = require('fs'); | |
var langDir = __dirname+"/git/country-list/country/cldr"; | |
var dest = __dirname+"/langs.json"; | |
var languages = {}; | |
fs.readdir(langDir, function(err, list) { | |
console.log(err); | |
// console.log(list); | |
for (var i = 0; i < list.length; i++) { | |
var file = langDir+"/"+list[i]+"/language.json"; | |
if (fs.existsSync(file)) { | |
languages[list[i]] = require(file); | |
} | |
} | |
// console.log(languages); | |
var result = JSON.stringify(languages,null, 2); | |
// console.log(result); | |
fs.writeFile(dest, result, function(err) { | |
if(err) { | |
console.log(err); | |
} else { | |
console.log("The file was saved!"); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment