Fixes for locale matching

This commit is contained in:
Jamie Kyle 2023-05-17 10:19:27 -07:00 committed by GitHub
parent f42192fb5a
commit 0032d49e23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 179 additions and 5890 deletions

View file

@ -4,6 +4,7 @@
import { execSync } from 'child_process';
import fsExtra from 'fs-extra';
import path from 'path';
import fastGlob from 'fast-glob';
const { SMARTLING_USER, SMARTLING_SECRET } = process.env;
@ -16,6 +17,16 @@ if (!SMARTLING_SECRET) {
process.exit(1);
}
console.log('Cleaning _locales directory...');
const dirEntries = fastGlob.sync(['_locales/*', '!_locales/en'], {
onlyDirectories: true,
absolute: true,
});
for (const dirEntry of dirEntries) {
fsExtra.rmdirSync(dirEntry, { recursive: true });
}
console.log('Fetching latest strings!');
console.log();
execSync(
@ -51,6 +62,9 @@ rename('zh-YU', 'yue');
// we need to rename it to "zh-Hant" explicitly to make it work.
rename('zh-TW', 'zh-Hant');
// "YR" is not a valid region subtag. Smartling made it up.
rename('sr-YR', 'sr');
console.log('Formatting newly-downloaded strings!');
console.log();
execSync('yarn format', {