Skip to content

Commit

Permalink
ensure that we default users with browser language code 'zh' to the s…
Browse files Browse the repository at this point in the history
…upported 'zh_CN' language code
  • Loading branch information
adonesky1 committed Oct 31, 2022
1 parent 691a77b commit 27a3324
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/scripts/lib/get-first-preferred-lang-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,15 @@ export default async function getFirstPreferredLangCode() {
.find(
(code) =>
existingLocaleCodes[code] !== undefined ||
existingLocaleCodes[code.split('-')[0]] !== undefined,
existingLocaleCodes[code.split('-')[0]] !== undefined ||
code === 'zh',
);

// ensures that we default users with browser language code 'zh' to the supported 'zh_CN' language code
if (firstPreferredLangCode === 'zh') {
firstPreferredLangCode = 'zh-cn';
}

// if we have matched against a code with a '-' present, meaning its a regional
// code for which we have a non-regioned locale, we need to set firstPreferredLangCode
// to the correct non-regional code.
Expand Down

0 comments on commit 27a3324

Please sign in to comment.