Merge pull request #299 from mikecao/dev

Added lang-ignore.json.
This commit is contained in:
Mike Cao 2020-10-13 23:01:37 -07:00 committed by GitHub
commit 8430ba0379
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -2,6 +2,7 @@ const fs = require('fs');
const path = require('path');
const chalk = require('chalk');
const messages = require('../lang/en-US.json');
const ignore = require('./lang-ignore.json');
const dir = path.resolve(__dirname, '../lang');
const files = fs.readdirSync(dir);
@ -10,13 +11,15 @@ const keys = Object.keys(messages).sort();
files.forEach(file => {
if (file !== 'en-US.json') {
const lang = require(`../lang/${file}`);
const id = file.replace('.json', '');
console.log(chalk.yellowBright(`\n## ${file}`));
keys.forEach(key => {
const orig = messages[key];
const check = lang[key];
const ignored = ignore[id]?.includes(key);
if (!check || check === orig) {
if (!ignored && (!check || check === orig)) {
console.log(chalk.redBright('*'), chalk.greenBright(`${key}:`), orig);
}
});

10
scripts/lang-ignore.json Normal file
View File

@ -0,0 +1,10 @@
{
"de-DE": [
"label.administrator",
"label.name",
"metrics.device.desktop",
"metrics.device.laptop",
"metrics.device.tablet",
"metrics.referrers"
]
}