Gaëtan Renaudeau 7 years ago
parent
commit
89a7b54419
  1. 14
      src/components/AccountPage/index.js
  2. 14
      src/components/DashboardPage/index.js
  3. 25
      src/components/SettingsPage/sections/Display.js
  4. 2
      src/components/base/Chart/Tooltip.js
  5. 36
      src/components/base/FormattedVal/index.js
  6. 1
      src/components/base/InputCurrency/index.js
  7. 2
      src/components/base/Select/index.js
  8. 245
      src/helpers/countries.json
  9. 397
      src/helpers/regions.json
  10. 9
      src/reducers/settings.js
  11. 4
      src/renderer/init.js

14
src/components/AccountPage/index.js

@ -16,12 +16,12 @@ import type { Account } from '@ledgerhq/live-common/lib/types'
import { MODAL_SEND, MODAL_RECEIVE, MODAL_SETTINGS_ACCOUNT } from 'config/constants'
import type { T, Settings } from 'types/common'
import type { T } from 'types/common'
import { darken } from 'styles/helpers'
import { getAccountById } from 'reducers/accounts'
import { getCounterValueCode } from 'reducers/settings'
import { getCounterValueCode, localeSelector } from 'reducers/settings'
import { openModal } from 'reducers/modals'
import IconControls from 'icons/Controls'
@ -57,7 +57,7 @@ const ButtonSettings = styled(Button).attrs({
const mapStateToProps = (state, props) => ({
account: getAccountById(state, props.match.params.id),
counterValue: getCounterValueCode(state),
settings: state.settings,
settings: localeSelector(state),
})
const mapDispatchToProps = {
@ -69,7 +69,7 @@ type Props = {
t: T,
account?: Account,
openModal: Function,
settings: Settings,
locale: string,
}
type State = {
@ -84,7 +84,7 @@ class AccountPage extends PureComponent<Props, State> {
}
handleCalculateBalance = data => {
const { counterValue, account, settings } = this.props
const { counterValue, account, locale } = this.props
if (!account) {
return
@ -99,14 +99,14 @@ class AccountPage extends PureComponent<Props, State> {
balance: {
currency: formatCurrencyUnit(account.unit, account.balance, {
showCode: true,
locale: settings.language,
locale,
}),
counterValue: formatCurrencyUnit(
getFiatCurrencyByTicker(counterValue).units[0],
data.totalBalance,
{
showCode: true,
locale: settings.language,
locale,
},
),
},

14
src/components/DashboardPage/index.js

@ -15,12 +15,12 @@ import type { Account } from '@ledgerhq/live-common/lib/types'
import chunk from 'lodash/chunk'
import type { T, Settings } from 'types/common'
import type { T } from 'types/common'
import { colors } from 'styles/theme'
import { getVisibleAccounts } from 'reducers/accounts'
import { getCounterValueCode } from 'reducers/settings'
import { getCounterValueCode, localeSelector } from 'reducers/settings'
import { updateOrderAccounts } from 'actions/accounts'
import { saveSettings } from 'actions/settings'
@ -38,7 +38,7 @@ import AccountsOrder from './AccountsOrder'
const mapStateToProps = state => ({
accounts: getVisibleAccounts(state),
counterValue: getCounterValueCode(state),
settings: state.settings,
locale: localeSelector(state),
})
const mapDispatchToProps = {
@ -52,11 +52,11 @@ type Props = {
accounts: Account[],
push: Function,
counterValue: string,
settings: Settings,
locale: string,
}
type State = {
accountsChunk: Array<Array<Account | null>>,
accountsChunk: Array<Array<?Account>>,
selectedTime: string,
daysCount: number,
}
@ -88,7 +88,7 @@ class DashboardPage extends PureComponent<Props, State> {
}
handleCalculateBalance = data => {
const { counterValue, settings } = this.props
const { counterValue, locale } = this.props
if (process.platform === 'darwin' && this._cacheBalance !== data.totalBalance) {
this._cacheBalance = data.totalBalance
@ -102,7 +102,7 @@ class DashboardPage extends PureComponent<Props, State> {
data.totalBalance,
{
showCode: true,
locale: settings.language,
locale,
},
),
},

25
src/components/SettingsPage/sections/Display.js

@ -10,7 +10,7 @@ import Select from 'components/base/Select'
import RadioGroup from 'components/base/RadioGroup'
import IconDisplay from 'icons/Display'
import COUNTRIES from 'helpers/countries.json'
import regionsByKey from 'helpers/regions.json'
import {
SettingsSection as Section,
@ -19,6 +19,11 @@ import {
SettingsSectionRow as Row,
} from '../SettingsSection'
const regions = Object.keys(regionsByKey).map(key => {
const [language, region] = key.split('-')
return { key, language, region, name: regionsByKey[key] }
})
const fiats = listFiatCurrencies()
.map(f => f.units[0])
// For now we take first unit, in the future we'll need to figure out something else
@ -89,7 +94,7 @@ class TabProfile extends PureComponent<Props, State> {
})
}
handleChangeRegion = (region: string) => {
handleChangeRegion = ({ region }: *) => {
const { saveSettings } = this.props
this.setState({ cachedRegion: region })
window.requestIdleCallback(() => {
@ -118,7 +123,9 @@ class TabProfile extends PureComponent<Props, State> {
} = this.state
const { languages } = this.getDatas()
const currentLanguage = languages.find(l => l.key === cachedLanguageKey)
const currentRegion = COUNTRIES.find(r => r.key === cachedRegion)
const regionsFiltered = regions.filter(({ language }) => cachedLanguageKey === language)
const currentRegion =
regionsFiltered.find(({ region }) => cachedRegion === region) || regionsFiltered[0]
return (
<Section>
@ -133,8 +140,6 @@ class TabProfile extends PureComponent<Props, State> {
desc={t('settings:display.counterValueDesc')}
>
<Select
searchable
fuseOptions={{ keys: ['name'] }}
style={{ minWidth: 250 }}
small
onChange={item => this.handleChangeCounterValue(item)}
@ -146,7 +151,7 @@ class TabProfile extends PureComponent<Props, State> {
</Row>
<Row title={t('settings:display.language')} desc={t('settings:display.languageDesc')}>
<Select
style={{ minWidth: 130 }}
style={{ minWidth: 250 }}
small
onChange={item => this.handleChangeLanguage(item.key)}
renderSelected={item => item && item.name}
@ -156,13 +161,11 @@ class TabProfile extends PureComponent<Props, State> {
</Row>
<Row title={t('settings:display.region')} desc={t('settings:display.regionDesc')}>
<Select
searchable
fuseOptions={{ keys: ['name'] }}
maxHeight={200}
onChange={item => this.handleChangeRegion(item.key)}
style={{ minWidth: 250 }}
onChange={this.handleChangeRegion}
renderSelected={item => item && item.name}
value={currentRegion}
items={COUNTRIES}
items={regionsFiltered}
/>
</Row>
<Row title={t('settings:display.stock')} desc={t('settings:display.stockDesc')}>

2
src/components/base/Chart/Tooltip.js

@ -6,7 +6,7 @@ import type { Unit } from '@ledgerhq/live-common/lib/types'
import { colors as themeColors } from 'styles/theme'
import { TooltipContainer } from 'components/base/Tooltip'
import { FormattedVal } from 'components/base/FormattedVal'
import FormattedVal from 'components/base/FormattedVal'
import type { Item } from './types'

36
src/components/base/FormattedVal/index.js

@ -6,7 +6,6 @@ import { connect } from 'react-redux'
import isUndefined from 'lodash/isUndefined'
import type { Settings } from 'types/common'
import type { Unit } from '@ledgerhq/live-common/lib/types'
import type { State } from 'reducers'
@ -15,6 +14,8 @@ import {
findCurrencyByTicker,
} from '@ledgerhq/live-common/lib/helpers/currencies'
import { marketIndicatorSelector, localeSelector } from 'reducers/settings'
import { getMarketColor } from 'styles/helpers'
import Box from 'components/base/Box'
@ -40,25 +41,30 @@ I.defaultProps = {
color: undefined,
}
const mapStateToProps = (state: State) => ({
settings: state.settings,
})
type Props = {
type OwnProps = {
alwaysShowSign?: boolean,
animateTicker?: boolean,
color?: string,
disableRounding?: boolean,
fiat?: string,
isPercent?: boolean,
settings?: Settings,
showCode?: boolean,
unit?: Unit,
val: number,
withIcon?: boolean,
}
export function FormattedVal(props: Props) {
const mapStateToProps = (state: State, _props: OwnProps) => ({
marketIndicator: marketIndicatorSelector(state),
locale: localeSelector(state),
})
type Props = OwnProps & {
marketIndicator: string,
locale: string,
}
function FormattedVal(props: Props) {
const {
animateTicker,
disableRounding,
@ -67,7 +73,8 @@ export function FormattedVal(props: Props) {
alwaysShowSign,
showCode,
withIcon,
settings,
locale,
marketIndicator,
color,
...p
} = props
@ -98,7 +105,6 @@ export function FormattedVal(props: Props) {
if (withIcon && isNegative) {
val *= -1
}
const locale = settings ? settings.language : ''
text = formatCurrencyUnit(unit, val, {
alwaysShowSign,
@ -112,12 +118,10 @@ export function FormattedVal(props: Props) {
text = <FlipTicker value={text} />
}
const marketColor = settings
? getMarketColor({
marketIndicator: settings.marketIndicator,
isNegative,
})
: undefined
const marketColor = getMarketColor({
marketIndicator,
isNegative,
})
return (
<T color={color || marketColor} withIcon={withIcon} {...p}>

1
src/components/base/InputCurrency/index.js

@ -18,6 +18,7 @@ function parseValue(value) {
}
function format(unit: Unit, value: number, { isFocused, showAllDigits }) {
// FIXME do we need locale for the input too ?
return formatCurrencyUnit(unit, value, {
useGrouping: !isFocused,
disableRounding: true,

2
src/components/base/Select/index.js

@ -32,7 +32,7 @@ type Props = {
renderItem?: (*) => Element<*>,
renderSelected?: any => Element<*>,
searchable?: boolean,
value?: Object | null,
value?: *,
disabled: boolean,
small?: boolean,
}

245
src/helpers/countries.json

@ -1,245 +0,0 @@
[
{ "name": "Afghanistan", "key": "AF" },
{ "name": "Åland Islands", "key": "AX" },
{ "name": "Albania", "key": "AL" },
{ "name": "Algeria", "key": "DZ" },
{ "name": "American Samoa", "key": "AS" },
{ "name": "AndorrA", "key": "AD" },
{ "name": "Angola", "key": "AO" },
{ "name": "Anguilla", "key": "AI" },
{ "name": "Antarctica", "key": "AQ" },
{ "name": "Antigua and Barbuda", "key": "AG" },
{ "name": "Argentina", "key": "AR" },
{ "name": "Armenia", "key": "AM" },
{ "name": "Aruba", "key": "AW" },
{ "name": "Australia", "key": "AU" },
{ "name": "Austria", "key": "AT" },
{ "name": "Azerbaijan", "key": "AZ" },
{ "name": "Bahamas", "key": "BS" },
{ "name": "Bahrain", "key": "BH" },
{ "name": "Bangladesh", "key": "BD" },
{ "name": "Barbados", "key": "BB" },
{ "name": "Belarus", "key": "BY" },
{ "name": "Belgium", "key": "BE" },
{ "name": "Belize", "key": "BZ" },
{ "name": "Benin", "key": "BJ" },
{ "name": "Bermuda", "key": "BM" },
{ "name": "Bhutan", "key": "BT" },
{ "name": "Bolivia", "key": "BO" },
{ "name": "Bosnia and Herzegovina", "key": "BA" },
{ "name": "Botswana", "key": "BW" },
{ "name": "Bouvet Island", "key": "BV" },
{ "name": "Brazil", "key": "BR" },
{ "name": "British Indian Ocean Territory", "key": "IO" },
{ "name": "Brunei Darussalam", "key": "BN" },
{ "name": "Bulgaria", "key": "BG" },
{ "name": "Burkina Faso", "key": "BF" },
{ "name": "Burundi", "key": "BI" },
{ "name": "Cambodia", "key": "KH" },
{ "name": "Cameroon", "key": "CM" },
{ "name": "Canada", "key": "CA" },
{ "name": "Cape Verde", "key": "CV" },
{ "name": "Cayman Islands", "key": "KY" },
{ "name": "Central African Republic", "key": "CF" },
{ "name": "Chad", "key": "TD" },
{ "name": "Chile", "key": "CL" },
{ "name": "China", "key": "CN" },
{ "name": "Christmas Island", "key": "CX" },
{ "name": "Cocos (Keeling) Islands", "key": "CC" },
{ "name": "Colombia", "key": "CO" },
{ "name": "Comoros", "key": "KM" },
{ "name": "Congo", "key": "CG" },
{ "name": "Congo, The Democratic Republic of the", "key": "CD" },
{ "name": "Cook Islands", "key": "CK" },
{ "name": "Costa Rica", "key": "CR" },
{ "name": "Cote D'Ivoire", "key": "CI" },
{ "name": "Croatia", "key": "HR" },
{ "name": "Cuba", "key": "CU" },
{ "name": "Cyprus", "key": "CY" },
{ "name": "Czech Republic", "key": "CZ" },
{ "name": "Denmark", "key": "DK" },
{ "name": "Djibouti", "key": "DJ" },
{ "name": "Dominica", "key": "DM" },
{ "name": "Dominican Republic", "key": "DO" },
{ "name": "Ecuador", "key": "EC" },
{ "name": "Egypt", "key": "EG" },
{ "name": "El Salvador", "key": "SV" },
{ "name": "Equatorial Guinea", "key": "GQ" },
{ "name": "Eritrea", "key": "ER" },
{ "name": "Estonia", "key": "EE" },
{ "name": "Ethiopia", "key": "ET" },
{ "name": "Falkland Islands (Malvinas)", "key": "FK" },
{ "name": "Faroe Islands", "key": "FO" },
{ "name": "Fiji", "key": "FJ" },
{ "name": "Finland", "key": "FI" },
{ "name": "France", "key": "FR" },
{ "name": "French Guiana", "key": "GF" },
{ "name": "French Polynesia", "key": "PF" },
{ "name": "French Southern Territories", "key": "TF" },
{ "name": "Gabon", "key": "GA" },
{ "name": "Gambia", "key": "GM" },
{ "name": "Georgia", "key": "GE" },
{ "name": "Germany", "key": "DE" },
{ "name": "Ghana", "key": "GH" },
{ "name": "Gibraltar", "key": "GI" },
{ "name": "Greece", "key": "GR" },
{ "name": "Greenland", "key": "GL" },
{ "name": "Grenada", "key": "GD" },
{ "name": "Guadeloupe", "key": "GP" },
{ "name": "Guam", "key": "GU" },
{ "name": "Guatemala", "key": "GT" },
{ "name": "Guernsey", "key": "GG" },
{ "name": "Guinea", "key": "GN" },
{ "name": "Guinea-Bissau", "key": "GW" },
{ "name": "Guyana", "key": "GY" },
{ "name": "Haiti", "key": "HT" },
{ "name": "Heard Island and Mcdonald Islands", "key": "HM" },
{ "name": "Holy See (Vatican City State)", "key": "VA" },
{ "name": "Honduras", "key": "HN" },
{ "name": "Hong Kong", "key": "HK" },
{ "name": "Hungary", "key": "HU" },
{ "name": "Iceland", "key": "IS" },
{ "name": "India", "key": "IN" },
{ "name": "Indonesia", "key": "ID" },
{ "name": "Iran, Islamic Republic Of", "key": "IR" },
{ "name": "Iraq", "key": "IQ" },
{ "name": "Ireland", "key": "IE" },
{ "name": "Isle of Man", "key": "IM" },
{ "name": "Israel", "key": "IL" },
{ "name": "Italy", "key": "IT" },
{ "name": "Jamaica", "key": "JM" },
{ "name": "Japan", "key": "JP" },
{ "name": "Jersey", "key": "JE" },
{ "name": "Jordan", "key": "JO" },
{ "name": "Kazakhstan", "key": "KZ" },
{ "name": "Kenya", "key": "KE" },
{ "name": "Kiribati", "key": "KI" },
{ "name": "Korea, Democratic People'S Republic of", "key": "KP" },
{ "name": "Korea, Republic of", "key": "KR" },
{ "name": "Kuwait", "key": "KW" },
{ "name": "Kyrgyzstan", "key": "KG" },
{ "name": "Lao People'S Democratic Republic", "key": "LA" },
{ "name": "Latvia", "key": "LV" },
{ "name": "Lebanon", "key": "LB" },
{ "name": "Lesotho", "key": "LS" },
{ "name": "Liberia", "key": "LR" },
{ "name": "Libyan Arab Jamahiriya", "key": "LY" },
{ "name": "Liechtenstein", "key": "LI" },
{ "name": "Lithuania", "key": "LT" },
{ "name": "Luxembourg", "key": "LU" },
{ "name": "Macao", "key": "MO" },
{ "name": "Macedonia, The Former Yugoslav Republic of", "key": "MK" },
{ "name": "Madagascar", "key": "MG" },
{ "name": "Malawi", "key": "MW" },
{ "name": "Malaysia", "key": "MY" },
{ "name": "Maldives", "key": "MV" },
{ "name": "Mali", "key": "ML" },
{ "name": "Malta", "key": "MT" },
{ "name": "Marshall Islands", "key": "MH" },
{ "name": "Martinique", "key": "MQ" },
{ "name": "Mauritania", "key": "MR" },
{ "name": "Mauritius", "key": "MU" },
{ "name": "Mayotte", "key": "YT" },
{ "name": "Mexico", "key": "MX" },
{ "name": "Micronesia, Federated States of", "key": "FM" },
{ "name": "Moldova, Republic of", "key": "MD" },
{ "name": "Monaco", "key": "MC" },
{ "name": "Mongolia", "key": "MN" },
{ "name": "Montserrat", "key": "MS" },
{ "name": "Morocco", "key": "MA" },
{ "name": "Mozambique", "key": "MZ" },
{ "name": "Myanmar", "key": "MM" },
{ "name": "Namibia", "key": "NA" },
{ "name": "Nauru", "key": "NR" },
{ "name": "Nepal", "key": "NP" },
{ "name": "Netherlands", "key": "NL" },
{ "name": "Netherlands Antilles", "key": "AN" },
{ "name": "New Caledonia", "key": "NC" },
{ "name": "New Zealand", "key": "NZ" },
{ "name": "Nicaragua", "key": "NI" },
{ "name": "Niger", "key": "NE" },
{ "name": "Nigeria", "key": "NG" },
{ "name": "Niue", "key": "NU" },
{ "name": "Norfolk Island", "key": "NF" },
{ "name": "Northern Mariana Islands", "key": "MP" },
{ "name": "Norway", "key": "NO" },
{ "name": "Oman", "key": "OM" },
{ "name": "Pakistan", "key": "PK" },
{ "name": "Palau", "key": "PW" },
{ "name": "Palestinian Territory, Occupied", "key": "PS" },
{ "name": "Panama", "key": "PA" },
{ "name": "Papua New Guinea", "key": "PG" },
{ "name": "Paraguay", "key": "PY" },
{ "name": "Peru", "key": "PE" },
{ "name": "Philippines", "key": "PH" },
{ "name": "Pitcairn", "key": "PN" },
{ "name": "Poland", "key": "PL" },
{ "name": "Portugal", "key": "PT" },
{ "name": "Puerto Rico", "key": "PR" },
{ "name": "Qatar", "key": "QA" },
{ "name": "Reunion", "key": "RE" },
{ "name": "Romania", "key": "RO" },
{ "name": "Russian Federation", "key": "RU" },
{ "name": "RWANDA", "key": "RW" },
{ "name": "Saint Helena", "key": "SH" },
{ "name": "Saint Kitts and Nevis", "key": "KN" },
{ "name": "Saint Lucia", "key": "LC" },
{ "name": "Saint Pierre and Miquelon", "key": "PM" },
{ "name": "Saint Vincent and the Grenadines", "key": "VC" },
{ "name": "Samoa", "key": "WS" },
{ "name": "San Marino", "key": "SM" },
{ "name": "Sao Tome and Principe", "key": "ST" },
{ "name": "Saudi Arabia", "key": "SA" },
{ "name": "Senegal", "key": "SN" },
{ "name": "Serbia and Montenegro", "key": "CS" },
{ "name": "Seychelles", "key": "SC" },
{ "name": "Sierra Leone", "key": "SL" },
{ "name": "Singapore", "key": "SG" },
{ "name": "Slovakia", "key": "SK" },
{ "name": "Slovenia", "key": "SI" },
{ "name": "Solomon Islands", "key": "SB" },
{ "name": "Somalia", "key": "SO" },
{ "name": "South Africa", "key": "ZA" },
{ "name": "South Georgia and the South Sandwich Islands", "key": "GS" },
{ "name": "Spain", "key": "ES" },
{ "name": "Sri Lanka", "key": "LK" },
{ "name": "Sudan", "key": "SD" },
{ "name": "Suriname", "key": "SR" },
{ "name": "Svalbard and Jan Mayen", "key": "SJ" },
{ "name": "Swaziland", "key": "SZ" },
{ "name": "Sweden", "key": "SE" },
{ "name": "Switzerland", "key": "CH" },
{ "name": "Syrian Arab Republic", "key": "SY" },
{ "name": "Taiwan, Province of China", "key": "TW" },
{ "name": "Tajikistan", "key": "TJ" },
{ "name": "Tanzania, United Republic of", "key": "TZ" },
{ "name": "Thailand", "key": "TH" },
{ "name": "Timor-Leste", "key": "TL" },
{ "name": "Togo", "key": "TG" },
{ "name": "Tokelau", "key": "TK" },
{ "name": "Tonga", "key": "TO" },
{ "name": "Trinidad and Tobago", "key": "TT" },
{ "name": "Tunisia", "key": "TN" },
{ "name": "Turkey", "key": "TR" },
{ "name": "Turkmenistan", "key": "TM" },
{ "name": "Turks and Caicos Islands", "key": "TC" },
{ "name": "Tuvalu", "key": "TV" },
{ "name": "Uganda", "key": "UG" },
{ "name": "Ukraine", "key": "UA" },
{ "name": "United Arab Emirates", "key": "AE" },
{ "name": "United Kingdom", "key": "GB" },
{ "name": "United States", "key": "US" },
{ "name": "United States Minor Outlying Islands", "key": "UM" },
{ "name": "Uruguay", "key": "UY" },
{ "name": "Uzbekistan", "key": "UZ" },
{ "name": "Vanuatu", "key": "VU" },
{ "name": "Venezuela", "key": "VE" },
{ "name": "Viet Nam", "key": "VN" },
{ "name": "Virgin Islands, British", "key": "VG" },
{ "name": "Virgin Islands, U.S.", "key": "VI" },
{ "name": "Wallis and Futuna", "key": "WF" },
{ "name": "Western Sahara", "key": "EH" },
{ "name": "Yemen", "key": "YE" },
{ "name": "Zambia", "key": "ZM" },
{ "name": "Zimbabwe", "key": "ZW" }
]

397
src/helpers/regions.json

@ -0,0 +1,397 @@
{
"af-NA": "Namibië",
"af-ZA": "Suid-Afrika",
"agq-CM": "Kàmàlûŋ",
"ak-GH": "Gaana",
"am-ET": "ኢትዮጵያ",
"ar-AE": "الإمارات العربية المتحدة",
"ar-BH": "البحرين",
"ar-DJ": "جيبوتي",
"ar-DZ": "الجزائر",
"ar-EG": "مصر",
"ar-EH": "الصحراء الغربية",
"ar-ER": "أريتريا",
"ar-IL": "إسرائيل",
"ar-IQ": "العراق",
"ar-JO": "الأردن",
"ar-KM": "جزر القمر",
"ar-KW": "الكويت",
"ar-LB": "لبنان",
"ar-LY": "ليبيا",
"ar-MA": "المغرب",
"ar-MR": "موريتانيا",
"ar-OM": "عُمان",
"ar-PS": "فلسطين",
"ar-QA": "قطر",
"ar-SA": "المملكة العربية السعودية",
"ar-SD": "السودان",
"ar-SO": "الصومال",
"ar-SY": "سوريا",
"ar-TD": "تشاد",
"ar-TN": "تونس",
"ar-YE": "اليمن",
"as-IN": "ভাৰত",
"asa-TZ": "Tadhania",
"az-AZ": "Azərbaycan",
"bas-CM": "Kàmɛ̀rûn",
"be-BY": "Беларусь",
"bem-ZM": "Zambia",
"bez-TZ": "Hutanzania",
"bg-BG": "България",
"bm-ML": "Mali",
"bn-BD": "বাংলাদেশ",
"bn-IN": "ভারত",
"bo-CN": "རྒྱ་ནག",
"bo-IN": "རྒྱ་གར་",
"br-FR": "Frañs",
"brx-IN": "भारत",
"bs-BA": "Bosna i Hercegovina",
"ca-AD": "Andorra",
"ca-ES": "Espanya",
"cgg-UG": "Uganda",
"chr-US": "ᎠᎹᏰᏟ",
"cs-CZ": "Česká republika",
"cy-GB": "y Deyrnas Unedig",
"da-DK": "Danmark",
"dav-KE": "Kenya",
"de-AT": "Österreich",
"de-BE": "Belgien",
"de-CH": "Schweiz",
"de-DE": "Deutschland",
"de-LI": "Liechtenstein",
"de-LU": "Luxemburg",
"dje-NE": "Nižer",
"dua-CM": "Cameroun",
"dyo-SN": "Senegal",
"dz-BT": "འབྲུག",
"ebu-KE": "Kenya",
"ee-GH": "Ghana nutome",
"ee-TG": "Togo nutome",
"el-CY": "Κύπρος",
"el-GR": "Ελλάδα",
"en-AG": "Antigua and Barbuda",
"en-AS": "American Samoa",
"en-AU": "Australia",
"en-BB": "Barbados",
"en-BE": "Belgium",
"en-BM": "Bermuda",
"en-BS": "Bahamas",
"en-BW": "Botswana",
"en-BZ": "Belize",
"en-CA": "Canada",
"en-CM": "Cameroon",
"en-DM": "Dominica",
"en-FJ": "Fiji",
"en-FM": "Micronesia",
"en-GB": "United Kingdom",
"en-GD": "Grenada",
"en-GG": "Guernsey",
"en-GH": "Ghana",
"en-GI": "Gibraltar",
"en-GM": "Gambia",
"en-GU": "Guam",
"en-GY": "Guyana",
"en-HK": "Hong Kong",
"en-IE": "Ireland",
"en-IM": "Isle of Man",
"en-IN": "India",
"en-JE": "Jersey",
"en-JM": "Jamaica",
"en-KE": "Kenya",
"en-KI": "Kiribati",
"en-KN": "Saint Kitts and Nevis",
"en-KY": "Cayman Islands",
"en-LC": "Saint Lucia",
"en-LR": "Liberia",
"en-LS": "Lesotho",
"en-MG": "Madagascar",
"en-MH": "Marshall Islands",
"en-MP": "Northern Mariana Islands",
"en-MT": "Malta",
"en-MU": "Mauritius",
"en-MW": "Malawi",
"en-NA": "Namibia",
"en-NG": "Nigeria",
"en-NZ": "New Zealand",
"en-PG": "Papua New Guinea",
"en-PH": "Philippines",
"en-PK": "Pakistan",
"en-PR": "Puerto Rico",
"en-PW": "Palau",
"en-SB": "Solomon Islands",
"en-SC": "Seychelles",
"en-SG": "Singapore",
"en-SL": "Sierra Leone",
"en-SS": "South Sudan",
"en-SZ": "Swaziland",
"en-TC": "Turks and Caicos Islands",
"en-TO": "Tonga",
"en-TT": "Trinidad and Tobago",
"en-TZ": "Tanzania",
"en-UG": "Uganda",
"en-UM": "U.S. Outlying Islands",
"en-US": "United States",
"en-VC": "Saint Vincent and the Grenadines",
"en-VG": "British Virgin Islands",
"en-VI": "U.S. Virgin Islands",
"en-VU": "Vanuatu",
"en-WS": "Samoa",
"en-ZA": "South Africa",
"en-ZM": "Zambia",
"en-ZW": "Zimbabwe",
"es-AR": "Argentina",
"es-BO": "Bolivia",
"es-CL": "Chile",
"es-CO": "Colombia",
"es-CR": "Costa Rica",
"es-CU": "Cuba",
"es-DO": "República Dominicana",
"es-EA": "Ceuta y Melilla",
"es-EC": "Ecuador",
"es-ES": "España",
"es-GQ": "Guinea Ecuatorial",
"es-GT": "Guatemala",
"es-HN": "Honduras",
"es-IC": "Islas Canarias",
"es-MX": "México",
"es-NI": "Nicaragua",
"es-PA": "Panamá",
"es-PE": "Perú",
"es-PH": "Filipinas",
"es-PR": "Puerto Rico",
"es-PY": "Paraguay",
"es-SV": "El Salvador",
"es-US": "Estados Unidos",
"es-UY": "Uruguay",
"es-VE": "Venezuela",
"es-XA": "Asturies",
"et-EE": "Eesti",
"eu-ES": "Espainia",
"ewo-CM": "Kamərún",
"fa-AF": "افغانستان",
"fa-IR": "ایران",
"ff-SN": "Senegaal",
"fi-FI": "Suomi",
"fil-PH": "Pilipinas",
"fo-FO": "Føroyar",
"fr-BE": "Belgique",
"fr-BF": "Burkina Faso",
"fr-BI": "Burundi",
"fr-BJ": "Bénin",
"fr-BL": "Saint-Barthélémy",
"fr-CA": "Canada",
"fr-CD": "République démocratique du Congo",
"fr-CF": "République centrafricaine",
"fr-CG": "Congo-Brazzaville",
"fr-CH": "Suisse",
"fr-CI": "Côte d’Ivoire",
"fr-CM": "Cameroun",
"fr-DJ": "Djibouti",
"fr-DZ": "Algérie",
"fr-FR": "France",
"fr-GA": "Gabon",
"fr-GF": "Guyane française",
"fr-GN": "Guinée",
"fr-GP": "Guadeloupe",
"fr-GQ": "Guinée équatoriale",
"fr-HT": "Haïti",
"fr-KM": "Comores",
"fr-LU": "Luxembourg",
"fr-MA": "Maroc",
"fr-MC": "Monaco",
"fr-MF": "Saint-Martin [partie française]",
"fr-MG": "Madagascar",
"fr-ML": "Mali",
"fr-MQ": "Martinique",
"fr-MR": "Mauritanie",
"fr-MU": "Maurice",
"fr-NC": "Nouvelle-Calédonie",
"fr-NE": "Niger",
"fr-PF": "Polynésie française",
"fr-RE": "Réunion",
"fr-RW": "Rwanda",
"fr-SC": "Seychelles",
"fr-SN": "Sénégal",
"fr-SY": "Syrie",
"fr-TD": "Tchad",
"fr-TG": "Togo",
"fr-TN": "Tunisie",
"fr-VU": "Vanuatu",
"fr-YT": "Mayotte",
"ga-IE": "Éire",
"gl-ES": "España",
"gsw-CH": "Schwiiz",
"gu-IN": "ભારત",
"guz-KE": "Kenya",
"gv-GB": "Rywvaneth Unys",
"ha-GH": "Gana",
"ha-NE": "Nijar",
"ha-NG": "Najeriya",
"haw-US": "ʻAmelika Hui Pū ʻIa",
"iw-IL": "ישראל",
"hi-IN": "भारत",
"hr-BA": "Bosna i Hercegovina",
"hr-HR": "Hrvatska",
"hu-HU": "Magyarország",
"hy-AM": "Հայաստան",
"in-ID": "Indonesia",
"ig-NG": "Nigeria",
"ii-CN": "ꍏꇩ",
"is-IS": "Ísland",
"it-CH": "Svizzera",
"it-IT": "Italia",
"it-SM": "San Marino",
"ja-JP": "日本",
"jgo-CM": "Kamɛlûn",
"jmc-TZ": "Tanzania",
"ka-GE": "საქართველო",
"kab-DZ": "Lezzayer",
"kam-KE": "Kenya",
"kde-TZ": "Tanzania",
"kea-CV": "Kabu Verdi",
"khq-ML": "Maali",
"ki-KE": "Kenya",
"kk-KZ": "Қазақстан",
"kl-GL": "Kalaallit Nunaat",
"kln-KE": "Emetab Kenya",
"km-KH": "កម្ពុជា",
"kn-IN": "ಭಾರತ",
"ko-KP": "조선 민주주의 인민 공화국",
"ko-KR": "대한민국",
"kok-IN": "भारत",
"ks-IN": "ہِنٛدوستان",
"ksb-TZ": "Tanzania",
"ksf-CM": "kamɛrún",
"kw-GB": "Rywvaneth Unys",
"lag-TZ": "Taansanía",
"lg-UG": "Yuganda",
"ln-AO": "Angóla",
"ln-CD": "Repibiki demokratiki ya Kongó",
"ln-CF": "Repibiki ya Afríka ya Káti",
"ln-CG": "Kongo",
"lo-LA": "ສ.ປ.ປ ລາວ",
"lt-LT": "Lietuva",
"lu-CD": "Ditunga wa Kongu",
"luo-KE": "Kenya",
"luy-KE": "Kenya",
"lv-LV": "Latvija",
"mas-KE": "Kenya",
"mas-TZ": "Tansania",
"mer-KE": "Kenya",
"mfe-MU": "Moris",
"mg-MG": "Madagasikara",
"mgh-MZ": "Umozambiki",
"mgo-CM": "Kamalun",
"mk-MK": "Македонија",
"ml-IN": "ഇന്ത്യ",
"mn-MN": "Монгол",
"mr-IN": "भारत",
"ms-BN": "Brunei",
"ms-MY": "Malaysia",
"ms-SG": "Singapura",
"mt-MT": "Malta",
"mua-CM": "kameruŋ",
"my-MM": "မြန်မာ",
"naq-NA": "Namibiab",
"nb-NO": "Norge",
"nd-ZW": "Zimbabwe",
"ne-IN": "भारत",
"ne-NP": "नेपाल",
"nl-AW": "Aruba",
"nl-BE": "België",
"nl-CW": "Curaçao",
"nl-NL": "Nederland",
"nl-SR": "Suriname",
"nl-SX": "Sint-Maarten",
"nmg-CM": "Kamerun",
"nn-NO": "Noreg",
"nus-SD": "Sudan",
"nyn-UG": "Uganda",
"om-ET": "Itoophiyaa",
"om-KE": "Keeniyaa",
"or-IN": "ଭାରତ",
"pa-PK": "پکستان",
"pa-IN": "ਭਾਰਤ",
"pl-PL": "Polska",
"ps-AF": "افغانستان",
"pt-AO": "Angola",
"pt-BR": "Brasil",
"pt-CV": "Cabo Verde",
"pt-GW": "Guiné Bissau",
"pt-MO": "Macau",
"pt-MZ": "Moçambique",
"pt-PT": "Portugal",
"pt-ST": "São Tomé e Príncipe",
"pt-TL": "Timor-Leste",
"rm-CH": "Svizra",
"rn-BI": "Uburundi",
"ro-MD": "Republica Moldova",
"ro-RO": "România",
"rof-TZ": "Tanzania",
"ru-BY": "Беларусь",
"ru-KG": "Киргизия",
"ru-KZ": "Казахстан",
"ru-MD": "Молдова",
"ru-RU": "Россия",
"ru-UA": "Украина",
"rw-RW": "Rwanda",
"rwk-TZ": "Tanzania",
"saq-KE": "Kenya",
"sbp-TZ": "Tansaniya",
"seh-MZ": "Moçambique",
"ses-ML": "Maali",
"sg-CF": "Ködörösêse tî Bêafrîka",
"shi-MA": "lmɣrib",
"si-LK": "ශ්‍රී ලංකාව",
"sk-SK": "Slovensko",
"sl-SI": "Slovenija",
"sn-ZW": "Zimbabwe",
"so-DJ": "Jabuuti",
"so-ET": "Itoobiya",
"so-KE": "Kiiniya",
"so-SO": "Soomaaliya",
"sq-AL": "Shqipëria",
"sq-MK": "Maqedoni",
"sr-BA": "Bosna i Hercegovina",
"sr-ME": "Crna Gora",
"sr-RS": "Srbija",
"sv-AX": "Åland",
"sv-FI": "Finland",
"sv-SE": "Sverige",
"sw-KE": "Kenya",
"sw-TZ": "Tanzania",
"sw-UG": "Uganda",
"swc-CD": "Jamhuri ya Kidemokrasia ya Kongo",
"ta-IN": "இந்தியா",
"ta-LK": "இலங்கை",
"ta-MY": "மலேஷியா",
"ta-SG": "சிங்கப்பூர்",
"te-IN": "భారత దేశం",
"teo-KE": "Kenia",
"teo-UG": "Uganda",
"th-TH": "ไทย",
"ti-ER": "ER",
"ti-ET": "ET",
"to-TO": "Tonga",
"tr-CY": "Güney Kıbrıs Rum Kesimi",
"tr-TR": "Türkiye",
"twq-NE": "Nižer",
"tzm-MA": "Meṛṛuk",
"uk-UA": "Україна",
"ur-IN": "بھارت",
"ur-PK": "پاکستان",
"uz-AF": "افغانستان",
"uz-UZ": "Oʻzbekiston",
"vai-LR": "Laibhiya",
"vi-VN": "Việt Nam",
"vun-TZ": "Tanzania",
"xog-UG": "Yuganda",
"yav-CM": "Kemelún",
"yo-NG": "Orílẹ́ède Nàìjíríà",
"zh-CN": "中国",
"zh-HK": "香港",
"zh-MO": "澳門",
"zh-SG": "新加坡",
"zh-TW": "台灣",
"zu-ZA": "iNingizimu Afrika"
}

9
src/reducers/settings.js

@ -24,7 +24,9 @@ export type SettingsState = {
}
/* have to check if available for all OS */
const language = window.navigator.language.split('-')[0]
const localeSplit = window.navigator.language.split('-')
const language = (localeSplit[0] || 'en').toLowerCase()
const region = (localeSplit[1] || 'US').toUpperCase()
const defaultState: SettingsState = {
hasCompletedOnboarding: false,
@ -37,7 +39,7 @@ const defaultState: SettingsState = {
},
marketIndicator: 'western',
currenciesSettings: {},
region: 'US',
region,
}
const CURRENCY_DEFAULTS_SETTINGS: CurrencySettings = {
@ -78,6 +80,9 @@ export const counterValueCurrencySelector = (state: State): ?Currency =>
export const getLanguage = (state: State) => state.settings.language
export const localeSelector = (state: State) =>
`${state.settings.language}-${state.settings.region}`
export const getOrderAccounts = (state: State) => state.settings.orderAccounts
export const currencySettingsSelector = (

4
src/renderer/init.js

@ -23,6 +23,10 @@ import App from 'components/App'
import 'styles/global'
if (process.env.LEDGER_RESET_ALL) {
db.resetAll()
}
// Init db with defaults if needed
db.init('settings', {})
db.init('counterValues', {})

Loading…
Cancel
Save