From 6e44d49d44392cc71481932256567fb3aced213f Mon Sep 17 00:00:00 2001 From: yasharAyari Date: Wed, 25 Oct 2017 16:44:48 +0200 Subject: [PATCH 1/7] Remove i18next from networks constant --- src/components/login/networks.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/components/login/networks.js b/src/components/login/networks.js index 6b060d439..dcb385ec8 100644 --- a/src/components/login/networks.js +++ b/src/components/login/networks.js @@ -1,17 +1,15 @@ -import i18next from 'i18next'; - export default () => ([ { - name: i18next.t('Mainnet'), + name: 'Mainnet', ssl: true, port: 443, }, { - name: i18next.t('Testnet'), + name: 'Testnet', testnet: true, ssl: true, port: 443, }, { - name: i18next.t('Custom Node'), + name: 'Custom Node', custom: true, address: 'http://localhost:4000', }, From 91d36e52947bdcc74937ddc1e59340d4438ee75c Mon Sep 17 00:00:00 2001 From: yasharAyari Date: Wed, 25 Oct 2017 16:45:58 +0200 Subject: [PATCH 2/7] Fix networks translation bug --- src/components/login/login.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/login/login.js b/src/components/login/login.js index 41628f22a..29fbb1464 100644 --- a/src/components/login/login.js +++ b/src/components/login/login.js @@ -3,6 +3,7 @@ import grid from 'flexboxgrid/dist/flexboxgrid.css'; import Input from 'react-toolbox/lib/input'; import Dropdown from 'react-toolbox/lib/dropdown'; import Button from 'react-toolbox/lib/button'; +import i18next from 'i18next'; import getNetworks from './networks'; import PassphraseInput from '../passphraseInput'; import styles from './login.css'; @@ -34,10 +35,17 @@ class Login extends React.Component { componentWillMount() { this.networks = getNetworks().map((network, index) => ({ - label: network.name, + label: i18next.t(network.name), value: index, })); + i18next.on('languageChanged', () => { + this.networks = getNetworks().map((network, index) => ({ + label: i18next.t(network.name), + value: index, + })); + }); + this.props.accountsRetrieved(); } From 3f44a8e15c5e896f4ec8d106dd124e5dd84c6203 Mon Sep 17 00:00:00 2001 From: yasharAyari Date: Wed, 25 Oct 2017 18:04:50 +0200 Subject: [PATCH 3/7] add translations strings to networks.js --- src/components/login/networks.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/login/networks.js b/src/components/login/networks.js index dcb385ec8..1ee4b8113 100644 --- a/src/components/login/networks.js +++ b/src/components/login/networks.js @@ -1,14 +1,14 @@ export default () => ([ - { + {// network name translation t('Mainnet'); name: 'Mainnet', ssl: true, port: 443, - }, { + }, {// network name translation t('Testnet'); name: 'Testnet', testnet: true, ssl: true, port: 443, - }, { + }, {// network name translation t('Custom Node'); name: 'Custom Node', custom: true, address: 'http://localhost:4000', From acad78cdd83f9a5795233cab0f0f4407a4bebe84 Mon Sep 17 00:00:00 2001 From: yasharAyari Date: Wed, 25 Oct 2017 18:05:45 +0200 Subject: [PATCH 4/7] Add network names to common.json --- src/locales/en/common.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/locales/en/common.json b/src/locales/en/common.json index 3b65aca1e..35c2876af 100644 --- a/src/locales/en/common.json +++ b/src/locales/en/common.json @@ -182,16 +182,15 @@ "Zero not allowed": "Zero not allowed", "confirmation": "confirmation", "confirmations": "confirmations", - "key": "key", "logout": "logout", "my votes": "my votes", "send": "send", "your passphrase will be required for logging in to your account.": "your passphrase will be required for logging in to your account.", "your second passphrase will be required for all transactions sent from this account": "your second passphrase will be required for all transactions sent from this account", - "{{count}} delegate names were successfully resolved for voting.": "{{count}} delegate name successfully resolved to add vote to.", - "{{count}} delegate names were successfully resolved for voting._plural": "{{count}} delegate names were successfully resolved for voting.", "{{count}} delegate names were successfully resolved for unvoting.": "{{count}} delegate name successfully resolved to remove vote from.", "{{count}} delegate names were successfully resolved for unvoting._plural": "{{count}} delegate names were successfully resolved for unvoting.", + "{{count}} delegate names were successfully resolved for voting.": "{{count}} delegate name successfully resolved to add vote to.", + "{{count}} delegate names were successfully resolved for voting._plural": "{{count}} delegate names were successfully resolved for voting.", "{{count}} of the delegate names selected for unvoting was not currently voted for:": "{{count}} of the delegate names selected for unvoting was not currently voted for:", "{{count}} of the delegate names selected for unvoting was not currently voted for:_plural": "{{count}} of the delegate names selected for unvoting were not currently voted for:", "{{count}} of the delegate names selected for voting was already voted for for:": "{{count}} of the delegate names selected for voting was already voted for for:", From 48f4b1d8a1b0b554a38569948e16ba5ff73f4841 Mon Sep 17 00:00:00 2001 From: yasharAyari Date: Wed, 25 Oct 2017 18:07:42 +0200 Subject: [PATCH 5/7] Translate network name in account component --- src/components/account/account.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/account/account.js b/src/components/account/account.js index 40bb821d0..86507309b 100644 --- a/src/components/account/account.js +++ b/src/components/account/account.js @@ -38,7 +38,7 @@ const Account = ({ {status}

- {peers.data.options.name} + {t(peers.data.options.name)}

{peers.data.currentPeer} From 4964fe50b311ac04501b2752c74bc9457ebd6b3c Mon Sep 17 00:00:00 2001 From: yasharAyari Date: Wed, 25 Oct 2017 18:22:52 +0200 Subject: [PATCH 6/7] Fix a bug in login component --- src/components/login/login.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/components/login/login.js b/src/components/login/login.js index 29fbb1464..5cc5b1a43 100644 --- a/src/components/login/login.js +++ b/src/components/login/login.js @@ -34,20 +34,20 @@ class Login extends React.Component { } componentWillMount() { - this.networks = getNetworks().map((network, index) => ({ - label: i18next.t(network.name), - value: index, - })); - + this.getNetworksList(); i18next.on('languageChanged', () => { - this.networks = getNetworks().map((network, index) => ({ - label: i18next.t(network.name), - value: index, - })); + this.getNetworksList(); }); this.props.accountsRetrieved(); } + + getNetworksList() { + this.networks = getNetworks().map((network, index) => ({ + label: i18next.t(network.name), + value: index, + })); + } componentDidUpdate() { if (this.props.account && this.props.account.address) { From 690439b12f94dd377f05f8f80bf7eff9cb177e30 Mon Sep 17 00:00:00 2001 From: yasharAyari Date: Wed, 25 Oct 2017 18:34:58 +0200 Subject: [PATCH 7/7] Fix a eslint bug in login component --- src/components/login/login.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/login/login.js b/src/components/login/login.js index 5cc5b1a43..6bcc4bc85 100644 --- a/src/components/login/login.js +++ b/src/components/login/login.js @@ -41,7 +41,7 @@ class Login extends React.Component { this.props.accountsRetrieved(); } - + getNetworksList() { this.networks = getNetworks().map((network, index) => ({ label: i18next.t(network.name),