Use LocaleMatcher to resolve system preferred locales

This commit is contained in:
Jamie Kyle 2023-04-17 12:26:57 -07:00 committed by GitHub
parent 68ae25f5cd
commit cdc68d1c34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 224 additions and 48 deletions

View file

@ -2,6 +2,8 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { execSync } from 'child_process';
import fsExtra from 'fs-extra';
import path from 'path';
const { SMARTLING_USER, SMARTLING_SECRET } = process.env;
@ -29,6 +31,19 @@ execSync(
}
);
function rename(from: string, to: string) {
console.log(`Renaming "${from}" to "${to}"`);
fsExtra.moveSync(path.join('_locales', from), path.join('_locales', to), {
overwrite: true,
});
}
// Smartling uses "zh-YU" for Cantonese (or Yue Chinese).
// This is wrong.
// The language tag for Yue Chinese is "yue"
// "zh-YU" actually implies "Chinese as spoken in Yugoslavia (canonicalized to Serbia)"
rename('zh-YU', 'yue');
console.log('Formatting newly-downloaded strings!');
console.log();
execSync('yarn format', {