Skip to content

Commit

Permalink
generate individual locale files
Browse files Browse the repository at this point in the history
  • Loading branch information
JunaidBabu committed May 10, 2020
1 parent a13da96 commit 1d26e99
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions pushthejson
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ node src/concat_data.js
node src/split_raw_data.js
node src/snapshot_zones.js
node src/generate_districts_daily.js
node src/generate_locale.js


node src/sanity_check.js
Expand Down
26 changes: 26 additions & 0 deletions src/generate_locale.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const fs = require('fs');
const locales = require('../tmp/locales.json');

var dir = './tmp/locales/';
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, { recursive: true });
}


console.log(locales.locales[0]);
all_files = {};

for (key in locales.locales[0]) {
all_files[key] = {};
}

locales.locales.forEach(element => {
for (key in element) {
all_files[key][element["english"]] = element[key];
}

});

for (key in all_files){
fs.writeFileSync("./tmp/locales/locale_"+key+".json", JSON.stringify(all_files[key], null, 2));
}

0 comments on commit 1d26e99

Please sign in to comment.