feat(dev): add remove unused translation string support to script

This commit is contained in:
David Ralph 2023-03-15 20:46:56 +00:00
parent 6d315974cc
commit 259eab31c6
2 changed files with 10 additions and 1 deletions

View File

@ -11,7 +11,17 @@ fs.readdirSync('../src/translations').forEach((file) => {
require('../src/translations/en_GB.json'),
require('../src/translations/' + file),
);
// remove unused strings
const en = require('../src/translations/en_GB.json');
const keys = Object.keys(newdata);
const enkeys = Object.keys(en);
const unused = keys.filter((key) => !enkeys.includes(key));
unused.forEach((key) => {
delete newdata[key];
});
fs.writeFileSync('../src/translations/' + file, JSON.stringify(newdata, null, 2));
// add new line
fs.appendFileSync('../src/translations/' + file, '\n');
});

View File

@ -87,7 +87,6 @@ body {
/* fonts (imported from fontsource) */
// i don't even know what the unicode-range is for, but we're keeping it so that nothing breaks
// same reason as why fontsource is never updated, it broke font loading last time so it flashed
@font-face {
font-family: 'Lexend Deca';
font-style: normal;