Skip to content

Commit

Permalink
webui strings and i18n converter
Browse files Browse the repository at this point in the history
  • Loading branch information
Elias committed Aug 25, 2021
1 parent c6465f7 commit aaa82cd
Show file tree
Hide file tree
Showing 3 changed files with 685 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.DS_Store
localize.converter.i18n/localization_i18n.json
24 changes: 24 additions & 0 deletions localize.converter.i18n/convert.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
var fs = require('fs');
var obj = JSON.parse(fs.readFileSync('../station.localization.json', 'utf8'));

// languages we want
var getLangs = ["en","fi","sv"];

var output = {};
for (var i = 0; i < getLangs.length; i++) {
output[getLangs[i]] = {translation: {}}
}
for (var i = 0; i < obj.translations.length; i++) {
var t = obj.translations[i];
for (var j = 0; j < getLangs.length; j++) {
if (t.ident_webui) {
if (t[getLangs[j]]) {
output[getLangs[j]].translation[t.ident_webui] = t[getLangs[j]]
} else {
console.log("MISSING " + t.ident_webui +" in " + getLangs[j])
}
}
}
}

fs.writeFileSync("localization_i18n.json",JSON.stringify(output, null, 2), 'utf8');
Loading

0 comments on commit aaa82cd

Please sign in to comment.