Create spreadsheets

This commit is contained in:
kngako
2022-10-24 18:56:36 +02:00
parent 881b66d1bf
commit 9d6e61af26
3 changed files with 29 additions and 3 deletions

25
scripts/spreadsheet.js Normal file
View File

@@ -0,0 +1,25 @@
const YAML = require("yaml")
const fs = require("fs")
if (process.argv[2]) {
const baseLangFile = fs.readFileSync('./locales/en.yaml', 'utf8')
const baseLanguage = YAML.parse(baseLangFile)
var output = `key;en;${process.argv[2]}\n`
const keys = Object.keys(baseLanguage)
for (const key in baseLanguage) {
if (Object.hasOwnProperty.call(baseLanguage, key)) {
const string = baseLanguage[key];
output += `${key};${string};\n`
}
}
fs.writeFileSync(`./spreadsheets/${process.argv[2]}.csv`, output)
} else {
console.log("Please give use a language we should translate into")
}