convert language files from ini to json

This commit is contained in:
Iván Eixarch 2012-12-16 20:03:23 +01:00 committed by Marcel Klehr
parent 6446281254
commit 1f4a171f10
37 changed files with 48 additions and 38 deletions

View file

@ -126,16 +126,26 @@ var generateLocaleIndex = function () {
return result;
}
var generateLocaleIndexJSON = function () {
if (_.isEmpty(locales)) getAllLocales();
var result = locales;
//result += locales['en']+"\n";
_.each(_.keys(locales), function(langcode) {
if (langcode != 'en') result[langcode]='/locales/'+langcode+'.json';
});
return JSON.stringify(result);
}
var root = path.resolve(__dirname+"/../locales");
getAllLocales();
_.each(locales, function(translation, langcode) {
console.log('escribiendo '+langcode);
translation = JSON.stringify(translation);
translation = '{"'+langcode+'":'+JSON.stringify(translation)+'}';
fs.writeFileSync(root+"/"+langcode+".json", translation, 'utf8');
});
console.log('escribiendo locales.json');
fs.writeFileSync(root+"/locales.json", JSON.stringify(locales), 'utf8');
console.log('escribiendo localeIndex.json');
fs.writeFileSync(root+"/localesIndex.json", generateLocaleIndexJSON(), 'utf8');