1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 01:47:00 +01:00

ensure that we default users with browser language code 'zh' to the supported 'zh_CN' language code (#16329)

This commit is contained in:
Alex Donesky 2022-10-31 16:48:51 -05:00 committed by GitHub
parent 08a4f93b53
commit aa59f7f89c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,8 +1,10 @@
import browser from 'webextension-polyfill';
import allLocales from '../../_locales/index.json';
// ensure that we default users with browser language code 'zh' to the supported 'zh_CN' language code
const existingLocaleCodes = { zh: 'zh_CN' };
// mapping some browsers return hyphen instead underscore in locale codes (e.g. zh_TW -> zh-tw)
const existingLocaleCodes = {};
allLocales.forEach((locale) => {
if (locale && locale.code) {
existingLocaleCodes[locale.code.toLowerCase().replace('_', '-')] =