Remap zh-TW to zh-Hant to match Traditional Chinese in other regions
This commit is contained in:
parent
593ae82c7f
commit
ed539c31b8
4 changed files with 12 additions and 3 deletions
|
@ -66,6 +66,6 @@
|
|||
"vi",
|
||||
"yue",
|
||||
"zh-CN",
|
||||
"zh-HK",
|
||||
"zh-TW"
|
||||
"zh-Hant",
|
||||
"zh-HK"
|
||||
]
|
||||
|
|
|
@ -44,6 +44,13 @@ function rename(from: string, to: string) {
|
|||
// "zh-YU" actually implies "Chinese as spoken in Yugoslavia (canonicalized to Serbia)"
|
||||
rename('zh-YU', 'yue');
|
||||
|
||||
// For most of the Chinese-speaking world, where we don't have a region specific
|
||||
// locale available (e.g. zh-HK), zh-TW is a suitable choice for "Traditional Chinese".
|
||||
//
|
||||
// However, Intl.LocaleMatcher won't match "zh-Hant-XX" to "zh-TW",
|
||||
// we need to rename it to "zh-Hant" explicitly to make it work.
|
||||
rename('zh-TW', 'zh-Hant');
|
||||
|
||||
console.log('Formatting newly-downloaded strings!');
|
||||
console.log();
|
||||
execSync('yarn format', {
|
||||
|
|
|
@ -35,7 +35,9 @@ describe('locale', async () => {
|
|||
await testCase(['an', 'fr-FR'], 'fr'); // If we ever add support for Aragonese, this test will fail.
|
||||
|
||||
// Specific cases we want to ensure work as expected
|
||||
await testCase(['zh-Hant-TW'], 'zh-TW');
|
||||
await testCase(['zh-TW'], 'zh-Hant');
|
||||
await testCase(['zh-Hant-TW'], 'zh-Hant');
|
||||
await testCase(['zh-Hant-CA'], 'zh-Hant');
|
||||
await testCase(['zh-Hant-HK'], 'zh-HK');
|
||||
await testCase(['zh'], 'zh-CN');
|
||||
await testCase(['yue'], 'yue');
|
||||
|
|
Loading…
Reference in a new issue