refactor(welcome): Improved readability of changing tab + intro cleanup

Co-authored-by: David Ralph <me@davidcralph.co.uk>
Co-authored-by: Isaac <contact@eartharoid.me>
This commit is contained in:
alexsparkes
2024-02-21 10:47:50 +00:00
parent 90ed4d8d7c
commit a45238ea54
7 changed files with 105 additions and 141 deletions

View File

@@ -38,31 +38,30 @@ fs.readdirSync('../src/i18n/locales').forEach((file) => {
fs.appendFileSync('../src/i18n/locales/' + file, '\n');
});
// do the same with achievements
fs.readdirSync('../src/i18n/achievements').forEach((file) => {
fs.readdirSync('../src/i18n/locales/achievements').forEach((file) => {
if (file === 'en_GB.json') {
return;
}
const en = require('../src/i18n/achievements/en_GB.json');
const newdata = merge(en, require('../src/i18n/achievements/' + file));
const en = require('../src/i18n/locales/achievements/en_GB.json');
const newdata = merge(en, require('../src/i18n/locales/achievements/' + file));
// remove strings not in english file
compareAndRemoveKeys(newdata, en);
// write new file
fs.writeFileSync('../src/i18n/achievements/' + file, JSON.stringify(newdata, null, 2));
fs.writeFileSync('../src/i18n/locales/achievements/' + file, JSON.stringify(newdata, null, 2));
// add new line
fs.appendFileSync('../src/i18n/achievements/' + file, '\n');
fs.appendFileSync('../src/i18n/locales/achievements/' + file, '\n');
// if missing translations from locales/ add them to achievements/
const locales = fs.readdirSync('../src/i18n/locales');
locales.forEach((locale) => {
if (!fs.existsSync('../src/i18n/achievements/' + locale)) {
fs.writeFileSync('../src/i18n/achievements/' + locale, JSON.stringify(en, null, 2));
fs.appendFileSync('../src/i18n/achievements/' + locale, '\n');
if (!fs.existsSync('../src/i18n/locales/achievements/' + locale)) {
fs.writeFileSync('../src/i18n/locales/achievements/' + locale, JSON.stringify(en, null, 2));
fs.appendFileSync('../src/i18n/locales/achievements/' + locale, '\n');
}
});
});
});