From c93cbeed64ad57352bedb363ddecffd444ef1ef3 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Tue, 13 Oct 2020 22:59:06 -0700 Subject: [PATCH] Added lang-ignore.json. --- scripts/check-lang.js | 5 ++++- scripts/lang-ignore.json | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 scripts/lang-ignore.json diff --git a/scripts/check-lang.js b/scripts/check-lang.js index 96522879..a8c54538 100644 --- a/scripts/check-lang.js +++ b/scripts/check-lang.js @@ -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); } }); diff --git a/scripts/lang-ignore.json b/scripts/lang-ignore.json new file mode 100644 index 00000000..418fad16 --- /dev/null +++ b/scripts/lang-ignore.json @@ -0,0 +1,10 @@ +{ + "de-DE": [ + "label.administrator", + "label.name", + "metrics.device.desktop", + "metrics.device.laptop", + "metrics.device.tablet", + "metrics.referrers" + ] +}