2022-11-04 05:33:37 +01:00
|
|
|
/* eslint-disable no-console */
|
2020-10-01 04:30:39 +02:00
|
|
|
const fs = require('fs');
|
|
|
|
const path = require('path');
|
|
|
|
const chalk = require('chalk');
|
2023-08-21 11:06:09 +02:00
|
|
|
const messages = require('../src/lang/en-US.json');
|
2020-10-22 04:35:59 +02:00
|
|
|
const ignore = require('../lang-ignore.json');
|
2020-10-01 04:30:39 +02:00
|
|
|
|
|
|
|
const dir = path.resolve(__dirname, '../lang');
|
|
|
|
const files = fs.readdirSync(dir);
|
|
|
|
const keys = Object.keys(messages).sort();
|
2020-10-22 19:36:08 +02:00
|
|
|
const filter = process.argv?.[2];
|
2020-10-01 04:30:39 +02:00
|
|
|
|
|
|
|
files.forEach(file => {
|
|
|
|
if (file !== 'en-US.json') {
|
|
|
|
const lang = require(`../lang/${file}`);
|
2020-10-14 07:59:06 +02:00
|
|
|
const id = file.replace('.json', '');
|
2020-10-01 04:30:39 +02:00
|
|
|
|
2020-10-22 19:36:08 +02:00
|
|
|
if (filter && filter !== id) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-10-15 02:22:46 +02:00
|
|
|
console.log(chalk.yellowBright(`\n## ${file.replace('.json', '')}`));
|
2020-10-14 23:16:00 +02:00
|
|
|
let count = 0;
|
2020-10-01 04:30:39 +02:00
|
|
|
keys.forEach(key => {
|
|
|
|
const orig = messages[key];
|
|
|
|
const check = lang[key];
|
2022-03-03 07:23:03 +01:00
|
|
|
const ignored = ignore[id] === '*' || ignore[id]?.includes(key);
|
2020-10-01 04:30:39 +02:00
|
|
|
|
2020-10-14 07:59:06 +02:00
|
|
|
if (!ignored && (!check || check === orig)) {
|
2020-10-01 04:30:39 +02:00
|
|
|
console.log(chalk.redBright('*'), chalk.greenBright(`${key}:`), orig);
|
2020-10-14 23:16:00 +02:00
|
|
|
count++;
|
2020-10-01 04:30:39 +02:00
|
|
|
}
|
|
|
|
});
|
2020-10-14 23:16:00 +02:00
|
|
|
|
|
|
|
if (count === 0) {
|
2022-03-03 07:23:03 +01:00
|
|
|
console.log('**Complete!**');
|
2020-10-14 23:16:00 +02:00
|
|
|
}
|
2020-10-01 04:30:39 +02:00
|
|
|
}
|
|
|
|
});
|