aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-04-04 07:22:17 +0800
committerDan <danjm.com@gmail.com>2018-04-04 07:22:17 +0800
commit3c4b72bf2c5eab9c98531fcf7b0929a415b63f87 (patch)
tree197d4cb9b427eb9b1a3f9052cc3d3e3c49962258
parent5aff114001d21696e7a7670db56b53cf3f36afa5 (diff)
downloadtangerine-wallet-browser-3c4b72bf2c5eab9c98531fcf7b0929a415b63f87.tar
tangerine-wallet-browser-3c4b72bf2c5eab9c98531fcf7b0929a415b63f87.tar.gz
tangerine-wallet-browser-3c4b72bf2c5eab9c98531fcf7b0929a415b63f87.tar.bz2
tangerine-wallet-browser-3c4b72bf2c5eab9c98531fcf7b0929a415b63f87.tar.lz
tangerine-wallet-browser-3c4b72bf2c5eab9c98531fcf7b0929a415b63f87.tar.xz
tangerine-wallet-browser-3c4b72bf2c5eab9c98531fcf7b0929a415b63f87.tar.zst
tangerine-wallet-browser-3c4b72bf2c5eab9c98531fcf7b0929a415b63f87.zip
Map existingLocaleCodes and userPreferredLocaleCodes to lower case in get-first-preferred-lang-code.js
-rw-r--r--app/scripts/lib/get-first-preferred-lang-code.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/app/scripts/lib/get-first-preferred-lang-code.js b/app/scripts/lib/get-first-preferred-lang-code.js
index 25221ff98..e3635434e 100644
--- a/app/scripts/lib/get-first-preferred-lang-code.js
+++ b/app/scripts/lib/get-first-preferred-lang-code.js
@@ -2,14 +2,16 @@ const extension = require('extensionizer')
const promisify = require('pify')
const allLocales = require('../../_locales/index.json')
-const existingLocaleCodes = allLocales.map(locale => locale.code.replace('_', '-'))
+const existingLocaleCodes = allLocales.map(locale => locale.code.toLowerCase().replace('_', '-'))
async function getFirstPreferredLangCode () {
const userPreferredLocaleCodes = await promisify(
extension.i18n.getAcceptLanguages,
{ errorFirst: false }
)()
- const firstPreferredLangCode = userPreferredLocaleCodes.find(code => existingLocaleCodes.includes(code))
+ const firstPreferredLangCode = userPreferredLocaleCodes
+ .map(code => code.toLowerCase())
+ .find(code => existingLocaleCodes.includes(code))
return firstPreferredLangCode || 'en'
}