Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

Commit

Permalink
Merge pull request #372 from gre/fix-langs
Browse files Browse the repository at this point in the history
fix langs
  • Loading branch information
meriadec authored May 25, 2018
2 parents 39e01a2 + a5d62d9 commit 958bd7c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/reducers/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
getFiatCurrencyByTicker,
listCryptoCurrencies,
} from '@ledgerhq/live-common/lib/helpers/currencies'
import languages from 'config/languages'
import { createSelector } from 'reselect'
import type { InputSelector as Selector } from 'reselect'
import type { CryptoCurrency, Currency, Account } from '@ledgerhq/live-common/lib/types'
Expand All @@ -32,9 +33,13 @@ export type SettingsState = {
}

/* have to check if available for all OS */
const localeSplit = window.navigator.language.split('-')
const language = (localeSplit[0] || 'en').toLowerCase()
const region = (localeSplit[1] || 'US').toUpperCase()
const localeSplit = (window.navigator.language || '').split('-')
let language = (localeSplit[0] || 'en').toLowerCase()
let region = (localeSplit[1] || 'US').toUpperCase()
if (!languages.includes(language)) {
language = 'en'
region = 'US'
}

const CURRENCY_DEFAULTS_SETTINGS: CurrencySettings = {
confirmationsToSpend: 10,
Expand Down

0 comments on commit 958bd7c

Please sign in to comment.