diff --git a/src/components/DashboardPage/AccountsOrder.js b/src/components/DashboardPage/AccountsOrder.js index 218cb92a..849947b7 100644 --- a/src/components/DashboardPage/AccountsOrder.js +++ b/src/components/DashboardPage/AccountsOrder.js @@ -183,7 +183,7 @@ class AccountsOrder extends Component { value={sortItems.find(item => item.key === cachedValue)} > - {'Sort by'} + {t('global.sortBy')} ({ name: `Day ${v}`, @@ -132,6 +128,13 @@ class DashboardPage extends PureComponent { } } + componentWillMount() { + this._itemsTimes = itemsTimes.map(item => ({ + ...item, + label: this.props.t(`time.${item.key}`), + })) + } + componentDidMount() { this._mounted = true @@ -190,9 +193,10 @@ class DashboardPage extends PureComponent { _timeout = undefined _mounted = false + _itemsTimes = [] render() { - const { push, accounts } = this.props + const { push, accounts, t } = this.props const { accountsChunk, allTransactions, selectedTime, fakeDatas, fakeDatasMerge } = this.state let accountIndex = 0 @@ -203,17 +207,17 @@ class DashboardPage extends PureComponent { - {'Good morning, Khalil.'} + {t('dashboard.greetings', { name: 'Khalil' })} {totalAccounts > 0 - ? `here is the summary of your ${totalAccounts} accounts` - : 'no accounts'} + ? t('dashboard.summary', { count: totalAccounts }) + : t('dashboard.noAccounts')} this.setState({ selectedTime: item.key })} /> @@ -243,7 +247,7 @@ class DashboardPage extends PureComponent { - {'Accounts'} + {t('sidebar.accounts')} @@ -277,7 +281,7 @@ class DashboardPage extends PureComponent { ))} - + { +type Props = { + t: T, +} + +class GlobalSearch extends PureComponent { state = { isFocused: false, } @@ -54,6 +60,7 @@ class GlobalSearch extends PureComponent<{}, State> { }) render() { + const { t } = this.props const { isFocused } = this.state return ( @@ -62,7 +69,7 @@ class GlobalSearch extends PureComponent<{}, State> { (this._input = input)} onBlur={this.handleBlur} onFocus={this.handleFocus} diff --git a/src/components/SettingsPage/Display.js b/src/components/SettingsPage/Display.js index d5e80d52..ad095538 100644 --- a/src/components/SettingsPage/Display.js +++ b/src/components/SettingsPage/Display.js @@ -1,7 +1,6 @@ // @flow import React, { PureComponent } from 'react' -import { translate } from 'react-i18next' import type { SettingsDisplay, T } from 'types/common' @@ -88,7 +87,7 @@ class TabProfile extends PureComponent { @@ -97,4 +96,4 @@ class TabProfile extends PureComponent { } } -export default translate()(TabProfile) +export default TabProfile diff --git a/src/components/SettingsPage/Profile.js b/src/components/SettingsPage/Profile.js index caf97df2..2f21e2c2 100644 --- a/src/components/SettingsPage/Profile.js +++ b/src/components/SettingsPage/Profile.js @@ -9,7 +9,7 @@ import set from 'lodash/set' import { setEncryptionKey } from 'helpers/db' -import type { SettingsProfile } from 'types/common' +import type { SettingsProfile, T } from 'types/common' import { unlock } from 'reducers/application' @@ -22,6 +22,7 @@ import Label from 'components/base/Label' type InputValue = SettingsProfile type Props = { + t: T, settings: SettingsProfile, onSaveSettings: Function, unlock: Function, @@ -80,6 +81,7 @@ class TabProfile extends PureComponent { } render() { + const { t } = this.props const { inputValue } = this.state const isPasswordChecked = get(inputValue, 'password.state', false) @@ -95,12 +97,12 @@ class TabProfile extends PureComponent { onClick={() => this.handleChangeInput('password.state')(!isPasswordChecked)} > -
{' Protect local data with a password'}
+
{t('settings.profile.protectWithPassword')}
{get(inputValue, 'password.state') === true && ( - + { )} diff --git a/src/components/SettingsPage/index.js b/src/components/SettingsPage/index.js index 740ad75d..44bd987a 100644 --- a/src/components/SettingsPage/index.js +++ b/src/components/SettingsPage/index.js @@ -59,6 +59,7 @@ class SettingsPage extends PureComponent { const { tab } = this.state const props = { + t, settings, onSaveSettings: this.handleSaveSettings, } diff --git a/src/components/TopBar.js b/src/components/TopBar.js index 31e68e4e..700e3688 100644 --- a/src/components/TopBar.js +++ b/src/components/TopBar.js @@ -1,11 +1,14 @@ // @flow import React, { PureComponent } from 'react' +import { compose } from 'redux' +import { translate } from 'react-i18next' import { connect } from 'react-redux' import styled from 'styled-components' import { ipcRenderer } from 'electron' import type { MapStateToProps, MapDispatchToProps } from 'react-redux' +import type { T } from 'types/common' import { rgba } from 'styles/helpers' import { getAccounts } from 'reducers/accounts' @@ -80,6 +83,7 @@ const mapDispatchToProps: MapDispatchToProps<*, *, *> = { } type Props = { + t: T, hasAccounts: boolean, hasPassword: boolean, lock: Function, @@ -140,14 +144,14 @@ class TopBar extends PureComponent { handleLock = () => this.props.lock() render() { - const { hasPassword, hasAccounts } = this.props + const { hasPassword, hasAccounts, t } = this.props const { sync } = this.state return ( - + @@ -164,14 +168,14 @@ class TopBar extends PureComponent { items={[ { key: 'profile', - label: 'Edit profile', + label: t('mainDropdown.editProfile'), icon: , }, ...(hasPassword ? [ { key: 'lock', - label: 'Lock application', + label: t('mainDropdown.lockApplication'), icon: , onClick: this.handleLock, }, @@ -203,4 +207,4 @@ class TopBar extends PureComponent { } } -export default connect(mapStateToProps, mapDispatchToProps)(TopBar) +export default compose(connect(mapStateToProps, mapDispatchToProps), translate())(TopBar) diff --git a/src/components/TransactionsList/index.js b/src/components/TransactionsList/index.js index 4736ca7d..191709f1 100644 --- a/src/components/TransactionsList/index.js +++ b/src/components/TransactionsList/index.js @@ -3,12 +3,13 @@ import React, { Component } from 'react' import styled from 'styled-components' import moment from 'moment' +import { translate } from 'react-i18next' import get from 'lodash/get' import noop from 'lodash/noop' import isEqual from 'lodash/isEqual' import { getIconByCoinType } from '@ledgerhq/currencies/react' -import type { Transaction as TransactionType } from 'types/common' +import type { Transaction as TransactionType, T } from 'types/common' import Box from 'components/base/Box' import Defer from 'components/base/Defer' @@ -71,10 +72,12 @@ const Cell = styled(Box).attrs({ ` const Transaction = ({ + t, onAccountClick, tx, withAccounts, }: { + t: T, onAccountClick?: Function, tx: TransactionType, withAccounts?: boolean, @@ -117,7 +120,7 @@ const Transaction = ({ }} > - {tx.balance > 0 ? 'From' : 'To'} + {tx.balance > 0 ? t('transactionsList.from') : t('transactionsList.to')} {tx.address} @@ -142,6 +145,7 @@ Transaction.defaultProps = { } type Props = { + t: T, onAccountClick?: Function, transactions: Array, withAccounts?: boolean, @@ -166,28 +170,31 @@ class TransactionsList extends Component { _hashCache = null render() { - const { transactions, withAccounts, onAccountClick } = this.props + const { transactions, withAccounts, onAccountClick, t } = this.props this._hashCache = this.getHashCache(transactions) return ( - {'Date'} - {withAccounts && {'Account'}} - {'Address'} + {t('transactionsList.date')} + {withAccounts && ( + {t('transactionsList.account')} + )} + {t('transactionsList.address')} - {'Amount'} + {t('transactionsList.amount')} - {transactions.map(t => ( + {transactions.map(trans => ( ))} @@ -197,4 +204,4 @@ class TransactionsList extends Component { } } -export default TransactionsList +export default translate()(TransactionsList) diff --git a/src/main/app.js b/src/main/app.js index 10807e50..99d35cc3 100644 --- a/src/main/app.js +++ b/src/main/app.js @@ -11,7 +11,13 @@ let mainWindow = null let forceClose = false -const { UPGRADE_EXTENSIONS, ELECTRON_WEBPACK_WDS_PORT, DEV_TOOLS, DEV_TOOLS_MODE } = process.env +const { + UPGRADE_EXTENSIONS, + ELECTRON_WEBPACK_WDS_PORT, + DEV_TOOLS, + DEV_TOOLS_MODE, + HIDE_DEV_WINDOW, +} = process.env const devTools = __DEV__ || DEV_TOOLS @@ -211,7 +217,7 @@ app.on('ready', async () => { await installExtensions() } - if (devTools) { + if (devTools && !HIDE_DEV_WINDOW) { createDevWindow() } diff --git a/static/i18n/en/translation.yml b/static/i18n/en/translation.yml index d0faf6f1..df5c145d 100644 --- a/static/i18n/en/translation.yml +++ b/static/i18n/en/translation.yml @@ -18,6 +18,11 @@ device: notConnected: Not connected dashboard: title: Dashboard + greetings: 'Good morning, {{name}}.' + summary: here is the summary of your account + summary_plural: 'here is the summary of your {{count}} accounts' + noAccounts: no accounts + recentActivity: Recent activity send: title: Send receive: @@ -39,6 +44,9 @@ settings: display: language: Language orderAccounts: Order accounts + profile: + protectWithPassword: Protect local data with a password + password: Password SelectAccount: placeholder: Select an account AccountPage: @@ -55,3 +63,22 @@ sendModal: Summary: Summary SecureValidation: Secure validation Confirmation: Confirmation +time: + day: Day + week: Week + month: Month + year: Year +global: + sortBy: Sort by + search: Search + save: Save +transactionsList: + date: Date + account: Account + address: Address + amount: Amount + from: From + to: To +mainDropdown: + editProfile: Edit profile + lockApplication: Lock application diff --git a/static/i18n/fr/translation.yml b/static/i18n/fr/translation.yml index 2151cb1e..c115c115 100644 --- a/static/i18n/fr/translation.yml +++ b/static/i18n/fr/translation.yml @@ -18,6 +18,11 @@ device: notConnected: Non connecté dashboard: title: Tableau de bord + greetings: 'Bonjour, {{name}}.' + summary: voici le résumé de votre compte + summary_plural: 'voici le résumé de vos {{count}} comptes' + noAccounts: aucun compte + recentActivity: Activité récente send: title: Envoyer receive: @@ -37,8 +42,11 @@ settings: blockchain: Blockchain profile: Profil display: - language: Langage + language: Langue orderAccounts: Ordre des comptes + profile: + protectWithPassword: Protégez les données locales avec un mot de passe + password: Mot de passe SelectAccount: placeholder: Sélectionner un compte AccountPage: @@ -55,3 +63,22 @@ sendModal: Summary: Résumé SecureValidation: Validation sécurisée Confirmation: Confirmation +time: + day: Jour + week: Semaine + month: Mois + year: Année +global: + sortBy: Trier par + search: Rechercher + save: Sauvegarder +transactionsList: + date: Date + account: Compte + address: Adresse + amount: Montant + from: Depuis + to: Vers +mainDropdown: + editProfile: Éditer le profil + lockApplication: Verrouiller l'application