Browse Source

fix langs

master
Gaëtan Renaudeau 7 years ago
parent
commit
a5d62d9ee3
  1. 11
      src/reducers/settings.js

11
src/reducers/settings.js

@ -6,6 +6,7 @@ import {
getFiatCurrencyByTicker, getFiatCurrencyByTicker,
listCryptoCurrencies, listCryptoCurrencies,
} from '@ledgerhq/live-common/lib/helpers/currencies' } from '@ledgerhq/live-common/lib/helpers/currencies'
import languages from 'config/languages'
import { createSelector } from 'reselect' import { createSelector } from 'reselect'
import type { InputSelector as Selector } from 'reselect' import type { InputSelector as Selector } from 'reselect'
import type { CryptoCurrency, Currency, Account } from '@ledgerhq/live-common/lib/types' import type { CryptoCurrency, Currency, Account } from '@ledgerhq/live-common/lib/types'
@ -32,9 +33,13 @@ export type SettingsState = {
} }
/* have to check if available for all OS */ /* have to check if available for all OS */
const localeSplit = window.navigator.language.split('-') const localeSplit = (window.navigator.language || '').split('-')
const language = (localeSplit[0] || 'en').toLowerCase() let language = (localeSplit[0] || 'en').toLowerCase()
const region = (localeSplit[1] || 'US').toUpperCase() let region = (localeSplit[1] || 'US').toUpperCase()
if (!languages.includes(language)) {
language = 'en'
region = 'US'
}
const CURRENCY_DEFAULTS_SETTINGS: CurrencySettings = { const CURRENCY_DEFAULTS_SETTINGS: CurrencySettings = {
confirmationsToSpend: 10, confirmationsToSpend: 10,

Loading…
Cancel
Save