Format all messages.json files in preparation for larger changes

This commit is contained in:
Scott Nonnenberg 2022-08-31 20:42:18 -07:00 committed by GitHub
parent db155b9752
commit 0ba23d4b62
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
77 changed files with 429741 additions and 574491 deletions

View file

@ -49,14 +49,12 @@ const en: LocaleMessagesType = readJsonSync(
const locales = readdirSync(join(BASE_DIR, ''));
console.log();
console.log('Re-adding placeholders to non-en locales');
console.log('Deleting placeholders for all locales');
locales.forEach((locale: string) => {
if (locale === 'en') {
return;
}
const target = resolve(join(BASE_DIR, locale, 'messages.json'));
if (!existsSync(target)) {
throw new Error(`File not found for ${locale}: ${target}`);
console.warn(`File not found for ${locale}: ${target}`);
return;
}
const messages: LocaleMessagesType = readJsonSync(target);
@ -65,13 +63,17 @@ locales.forEach((locale: string) => {
return;
}
messages[key].placeholders = en[key].placeholders;
delete messages[key].placeholders;
});
console.log(`Writing ${target}`);
writeFileSync(target, `${JSON.stringify(messages, null, 4)}\n`);
});
execSync('yarn format', {
stdio: [null, process.stdout, process.stderr],
});
if (failed) {
process.exit(1);
}