Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Commit

Permalink
Merge pull request #920 from LiskHQ/914-custom-node-translation-doesn…
Browse files Browse the repository at this point in the history
…t-update

Custom node translation doesn't update - Closes #914
  • Loading branch information
yasharAyari authored Oct 26, 2017
2 parents bb6bd3b + 690439b commit 37cb501
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/components/account/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const Account = ({
{status}
</span>
<p className="inner primary peer-network">
{peers.data.options.name}
{t(peers.data.options.name)}
</p>
<p className="inner secondary peer">
{peers.data.currentPeer}
Expand Down
14 changes: 11 additions & 3 deletions src/components/login/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -33,12 +34,19 @@ class Login extends React.Component {
}

componentWillMount() {
this.getNetworksList();
i18next.on('languageChanged', () => {
this.getNetworksList();
});

this.props.accountsRetrieved();
}

getNetworksList() {
this.networks = getNetworks().map((network, index) => ({
label: network.name,
label: i18next.t(network.name),
value: index,
}));

this.props.accountsRetrieved();
}

componentDidUpdate() {
Expand Down
14 changes: 6 additions & 8 deletions src/components/login/networks.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import i18next from 'i18next';

export default () => ([
{
name: i18next.t('Mainnet'),
{// network name translation t('Mainnet');
name: 'Mainnet',
ssl: true,
port: 443,
}, {
name: i18next.t('Testnet'),
}, {// network name translation t('Testnet');
name: 'Testnet',
testnet: true,
ssl: true,
port: 443,
}, {
name: i18next.t('Custom Node'),
}, {// network name translation t('Custom Node');
name: 'Custom Node',
custom: true,
address: 'http://localhost:4000',
},
Expand Down
5 changes: 2 additions & 3 deletions src/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:",
Expand Down

0 comments on commit 37cb501

Please sign in to comment.