1
0
mirror of synced 2025-12-22 11:26:57 -05:00

Use zh as language code instead of cn (#33560)

This commit is contained in:
Kevin Heis
2022-12-14 11:10:05 -08:00
committed by GitHub
parent aa3b224db2
commit e7983eb8d2
9 changed files with 21 additions and 17 deletions

View File

@@ -3,7 +3,12 @@ import parser from 'accept-language-parser'
import { USER_LANGUAGE_COOKIE_NAME } from '../lib/constants.js'
const chineseRegions = ['CN', 'HK']
const chineseRegions = [
'CN', // Mainland
'HK', // Hong Kong
'SG', // Singapore
'TW', // Taiwan
]
function translationExists(language) {
if (language.code === 'zh') {
@@ -14,7 +19,7 @@ function translationExists(language) {
}
function getLanguageCode(language) {
return language.code === 'zh' && chineseRegions.includes(language.region) ? 'cn' : language.code
return language.code === 'cn' && chineseRegions.includes(language.region) ? 'zh' : language.code
}
function getUserLanguage(browserLanguages) {