From 5dd406a19ae4a9c9457f5dd729a812dee319b5be Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Thu, 2 Mar 2017 12:24:54 +0100 Subject: [PATCH] Extract i18n strings in views/* (#4695) * i18n for writecontract * i18n for writecontract store * wallet i18n * wallet confirmations i18n * wallet details i18n * wallet transactions i18n * status i18n * status calls i18n * status callstoolbar i18n * status debug i18n * status editableValue i18n * status miningSettings i18n * status rpcCalls i18n * status rpcDocs i18n * status status i18n * signer i18n * signer origin i18n * signer signRequest i18n * signer transactionMainDetails i18n * sign transactionPending i18n * signer transactionPending i18n * Fix duplicate ids * Typo * Adapt tests for i18n * Actionbar i18n * contracts i18n * contract i18n * contract/queries i18n * contract/events i18n * application/frameError i18n * Actionbar key naming * addresses i18n * address i18n * accounts i18n (tooltip) * Plural strings for owner numbers * IdentityIcon placement * Re-apply s/actiobar/actionbar/ after merge --- js/src/ui/Actionbar/Import/import.js | 16 +- js/src/ui/Actionbar/Sort/sort.js | 50 ++++- js/src/ui/Icons/index.js | 7 + js/src/views/Accounts/Summary/summary.js | 8 +- js/src/views/Address/Delete/delete.js | 18 +- js/src/views/Address/address.js | 45 +++- js/src/views/Addresses/addresses.js | 26 ++- .../Application/FrameError/frameError.js | 6 +- js/src/views/Contract/Events/Event/event.js | 14 +- js/src/views/Contract/Events/events.js | 21 +- js/src/views/Contract/Queries/inputQuery.js | 12 +- js/src/views/Contract/Queries/queries.js | 10 +- js/src/views/Contract/contract.js | 71 ++++-- js/src/views/Contracts/contracts.js | 66 ++++-- .../components/RequestOrigin/requestOrigin.js | 67 +++++- .../RequestOrigin/requestOrigin.spec.js | 12 +- .../components/SignRequest/signRequest.js | 44 +++- .../transactionMainDetails.js | 37 ++- .../TransactionPending/transactionPending.js | 8 +- .../transactionPendingFormConfirm.js | 74 +++++- .../transactionPendingFormReject.js | 21 +- .../transactionPendingForm.js | 22 +- js/src/views/Signer/signer.js | 10 +- js/src/views/Status/components/Calls/Calls.js | 21 +- .../components/CallsToolbar/CallsToolbar.js | 29 ++- js/src/views/Status/components/Debug/debug.js | 38 +++- .../components/EditableValue/EditableValue.js | 26 ++- .../MiningSettings/miningSettings.js | 66 +++++- .../Status/components/RpcCalls/RpcCalls.js | 48 +++- .../Status/components/RpcDocs/RpcDocs.js | 50 ++++- .../views/Status/components/Status/status.js | 115 ++++++++-- js/src/views/Status/status.js | 10 +- .../Wallet/Confirmations/confirmations.js | 65 ++++-- js/src/views/Wallet/Details/details.js | 35 ++- .../views/Wallet/Transactions/transactions.js | 32 ++- js/src/views/Wallet/wallet.js | 83 ++++--- js/src/views/WriteContract/writeContract.js | 211 +++++++++++++++--- .../views/WriteContract/writeContractStore.js | 51 ++++- 38 files changed, 1251 insertions(+), 294 deletions(-) diff --git a/js/src/ui/Actionbar/Import/import.js b/js/src/ui/Actionbar/Import/import.js index ada951cd9..a447be4cb 100644 --- a/js/src/ui/Actionbar/Import/import.js +++ b/js/src/ui/Actionbar/Import/import.js @@ -65,7 +65,7 @@ export default class ActionbarImport extends Component { icon={ } label={ } @@ -87,19 +87,19 @@ export default class ActionbarImport extends Component { const steps = typeof renderValidation === 'function' ? [ , error ? ( ) : ( ) ] @@ -128,7 +128,7 @@ export default class ActionbarImport extends Component { key='cancel' label={ } @@ -147,7 +147,7 @@ export default class ActionbarImport extends Component { key='confirm' label={ } @@ -169,7 +169,7 @@ export default class ActionbarImport extends Component {

diff --git a/js/src/ui/Actionbar/Sort/sort.js b/js/src/ui/Actionbar/Sort/sort.js index 69085d35d..7fd775d12 100644 --- a/js/src/ui/Actionbar/Sort/sort.js +++ b/js/src/ui/Actionbar/Sort/sort.js @@ -15,6 +15,7 @@ // along with Parity. If not, see . import React, { Component, PropTypes } from 'react'; +import { FormattedMessage } from 'react-intl'; import { observer } from 'mobx-react'; import IconMenu from 'material-ui/IconMenu'; @@ -71,12 +72,38 @@ export default class ActionbarSort extends Component { > { showDefault - ? this.renderMenuItem('', 'Default') - : null + ? this.renderMenuItem('', ( + + )) + : null + } + { + this.renderMenuItem('tags', ( + + )) + } + { + this.renderMenuItem('name', ( + + )) + } + { + this.renderMenuItem('eth', ( + + )) } - { this.renderMenuItem('tags', 'Sort by tags') } - { this.renderMenuItem('name', 'Sort by name') } - { this.renderMenuItem('eth', 'Sort by ETH') } { this.renderSortByMetas() } @@ -88,8 +115,17 @@ export default class ActionbarSort extends Component { return metas .map((meta, index) => { - return this - .renderMenuItem(meta.key, `Sort by ${meta.label}`, index); + const label = ( + + ); + + return this.renderMenuItem(meta.key, label, index); }); } diff --git a/js/src/ui/Icons/index.js b/js/src/ui/Icons/index.js index 0ea4f7e0f..442aea92b 100644 --- a/js/src/ui/Icons/index.js +++ b/js/src/ui/Icons/index.js @@ -29,22 +29,29 @@ export ContractIcon from 'material-ui/svg-icons/action/code'; export CopyIcon from 'material-ui/svg-icons/content/content-copy'; export DashboardIcon from 'material-ui/svg-icons/action/dashboard'; export DeleteIcon from 'material-ui/svg-icons/action/delete'; +export DevelopIcon from 'material-ui/svg-icons/action/description'; export DoneIcon from 'material-ui/svg-icons/action/done-all'; export EditIcon from 'material-ui/svg-icons/content/create'; export ErrorIcon from 'material-ui/svg-icons/alert/error'; export FileUploadIcon from 'material-ui/svg-icons/file/file-upload'; export FileIcon from 'material-ui/svg-icons/editor/insert-drive-file'; export FingerprintIcon from 'material-ui/svg-icons/action/fingerprint'; +export GasIcon from 'material-ui/svg-icons/maps/local-gas-station'; export KeyIcon from 'material-ui/svg-icons/communication/vpn-key'; export KeyboardIcon from 'material-ui/svg-icons/hardware/keyboard'; export LinkIcon from 'material-ui/svg-icons/content/link'; +export ListIcon from 'material-ui/svg-icons/action/view-list'; export LockedIcon from 'material-ui/svg-icons/action/lock'; export MembershipIcon from 'material-ui/svg-icons/action/card-membership'; export MoveIcon from 'material-ui/svg-icons/action/open-with'; export NextIcon from 'material-ui/svg-icons/navigation/arrow-forward'; +export PauseIcon from 'material-ui/svg-icons/av/pause'; +export PlayIcon from 'material-ui/svg-icons/av/play-arrow'; export PrevIcon from 'material-ui/svg-icons/navigation/arrow-back'; export PrintIcon from 'material-ui/svg-icons/action/print'; export RefreshIcon from 'material-ui/svg-icons/action/autorenew'; +export ReorderIcon from 'material-ui/svg-icons/action/reorder'; +export ReplayIcon from 'material-ui/svg-icons/av/replay'; export SaveIcon from 'material-ui/svg-icons/content/save'; export SendIcon from 'material-ui/svg-icons/content/send'; export SettingsIcon from 'material-ui/svg-icons/action/settings'; diff --git a/js/src/views/Accounts/Summary/summary.js b/js/src/views/Accounts/Summary/summary.js index 6b077e558..8b40879c1 100644 --- a/js/src/views/Accounts/Summary/summary.js +++ b/js/src/views/Accounts/Summary/summary.js @@ -214,7 +214,13 @@ class Summary extends Component { />
- { owner.name } (owner) + ); diff --git a/js/src/views/Address/Delete/delete.js b/js/src/views/Address/Delete/delete.js index 36d0ea557..8aa5f6111 100644 --- a/js/src/views/Address/Delete/delete.js +++ b/js/src/views/Address/Delete/delete.js @@ -15,6 +15,7 @@ // along with Parity. If not, see . import React, { Component, PropTypes } from 'react'; +import { FormattedMessage } from 'react-intl'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; @@ -49,13 +50,21 @@ class Delete extends Component { return ( + } visible onDeny={ this.closeDeleteDialog } onConfirm={ this.onDeleteConfirmed } >
- Are you sure you want to remove the following address from your addressbook? +
- +
{ account.address } diff --git a/js/src/views/Address/address.js b/js/src/views/Address/address.js index 3a4f6d5f9..eb0a9bc4b 100644 --- a/js/src/views/Address/address.js +++ b/js/src/views/Address/address.js @@ -15,14 +15,13 @@ // along with Parity. If not, see . import React, { Component, PropTypes } from 'react'; +import { FormattedMessage } from 'react-intl'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; -import ActionDelete from 'material-ui/svg-icons/action/delete'; -import ContentCreate from 'material-ui/svg-icons/content/create'; -import ContentAdd from 'material-ui/svg-icons/content/add'; import { EditMeta, AddAddress } from '~/modals'; import { Actionbar, Button, Page } from '~/ui'; +import { AddIcon, DeleteIcon, EditIcon } from '~/ui/Icons'; import Header from '../Account/Header'; import Transactions from '../Account/Transactions'; @@ -146,14 +145,24 @@ class Address extends Component { const buttons = [
); - } catch (e) { return error; } + } catch (e) { + return error; + } } onImport = (content) => { diff --git a/js/src/views/Application/FrameError/frameError.js b/js/src/views/Application/FrameError/frameError.js index c1d022457..0cf1f4ef2 100644 --- a/js/src/views/Application/FrameError/frameError.js +++ b/js/src/views/Application/FrameError/frameError.js @@ -15,6 +15,7 @@ // along with Parity. If not, see . import React, { Component } from 'react'; +import { FormattedMessage } from 'react-intl'; import styles from './frameError.css'; @@ -22,7 +23,10 @@ export default class FrameError extends Component { render () { return (
- ERROR: This application cannot and should not be loaded in an embedded iFrame +
); } diff --git a/js/src/views/Contract/Events/Event/event.js b/js/src/views/Contract/Events/Event/event.js index de5cf6809..5e34e2dd7 100644 --- a/js/src/views/Contract/Events/Event/event.js +++ b/js/src/views/Contract/Events/Event/event.js @@ -17,6 +17,7 @@ import BigNumber from 'bignumber.js'; import moment from 'moment'; import React, { Component, PropTypes } from 'react'; +import { FormattedMessage } from 'react-intl'; import { IdentityIcon, IdentityName, Input, InputAddress } from '~/ui'; import ShortenedHash from '~/ui/ShortenedHash'; @@ -64,7 +65,12 @@ export default class Event extends Component {
{ event.state === 'pending' - ? 'pending' + ? ( + + ) : this.formatBlockTimestamp(block) }
{ this.formatNumber(transaction.blockNumber) }
@@ -96,7 +102,11 @@ export default class Event extends Component { center inline /> - { withName ? : address } + { + withName + ? + : address + } ); } diff --git a/js/src/views/Contract/Events/events.js b/js/src/views/Contract/Events/events.js index 37fbd0592..1731488d9 100644 --- a/js/src/views/Contract/Events/events.js +++ b/js/src/views/Contract/Events/events.js @@ -15,6 +15,7 @@ // along with Parity. If not, see . import React, { Component, PropTypes } from 'react'; +import { FormattedMessage } from 'react-intl'; import { uniq } from 'lodash'; import { Container, Loading } from '~/ui'; @@ -22,6 +23,13 @@ import { Container, Loading } from '~/ui'; import Event from './Event'; import styles from '../contract.css'; +const TITLE = ( + +); + export default class Events extends Component { static contextTypes = { api: PropTypes.object @@ -43,7 +51,7 @@ export default class Events extends Component { if (isLoading) { return ( - +
@@ -53,8 +61,13 @@ export default class Events extends Component { if (!events || !events.length) { return ( - -

No events has been sent from this contract.

+ +

+ +

); } @@ -73,7 +86,7 @@ export default class Events extends Component { }); return ( - + diff --git a/js/src/views/Contract/Queries/inputQuery.js b/js/src/views/Contract/Queries/inputQuery.js index 1418aa6b7..a93fe74d0 100644 --- a/js/src/views/Contract/Queries/inputQuery.js +++ b/js/src/views/Contract/Queries/inputQuery.js @@ -15,6 +15,7 @@ // along with Parity. If not, see . import React, { Component, PropTypes } from 'react'; +import { FormattedMessage } from 'react-intl'; import LinearProgress from 'material-ui/LinearProgress'; import { Card, CardActions, CardTitle, CardText } from 'material-ui/Card'; import { connect } from 'react-redux'; @@ -80,7 +81,12 @@ class InputQuery extends Component { ); } diff --git a/js/src/views/Status/components/RpcDocs/RpcDocs.js b/js/src/views/Status/components/RpcDocs/RpcDocs.js index a56d182a4..922346763 100644 --- a/js/src/views/Status/components/RpcDocs/RpcDocs.js +++ b/js/src/views/Status/components/RpcDocs/RpcDocs.js @@ -16,6 +16,7 @@ import React, { Component } from 'react'; import ReactDOM from 'react-dom'; +import { FormattedMessage } from 'react-intl'; import { sortBy } from 'lodash'; import List from 'material-ui/List/List'; import ListItem from 'material-ui/List/ListItem'; @@ -38,7 +39,12 @@ class RpcDocs extends Component {
-

RPC Docs

+

+ +

@@ -50,7 +56,12 @@ class RpcDocs extends Component {
+ } className={ styles.autocomplete } dataSource={ rpcMethods.map(m => m.name) } onNewRequest={ this.handleMethodChange } @@ -78,9 +89,38 @@ class RpcDocs extends Component { >

{ m.name }

-

Params{ !m.params.length ? ' - none' : '' }

- { m.params.map((p, idx) => ) } -

Returns -

+

+ + ) + : '' + } } + /> +

+ { + m.params.map((p, idx) => { + return ( + + ); + }) + } +

+ +

{ idx !== rpcMethods.length - 1 ?
: '' } diff --git a/js/src/views/Status/components/Status/status.js b/js/src/views/Status/components/Status/status.js index f7d06833a..efb0c80f7 100644 --- a/js/src/views/Status/components/Status/status.js +++ b/js/src/views/Status/components/Status/status.js @@ -17,6 +17,7 @@ import bytes from 'bytes'; import moment from 'moment'; import React, { Component, PropTypes } from 'react'; +import { FormattedMessage } from 'react-intl'; import { Container, ContainerTitle, Input } from '~/ui'; @@ -47,7 +48,14 @@ export default class Status extends Component {
- + + } + />
#{ nodeStatus.blockNumber.toFormat() }
@@ -56,15 +64,35 @@ export default class Status extends Component {
- + + } + />
{ peers }
- + + } + />
- { `${hashrate} H/s` } +
@@ -89,7 +117,12 @@ export default class Status extends Component { return ( - { nodeStatus.nodeName || 'Node' } + { nodeStatus.nodeName || ( + ) + } ); } @@ -107,11 +140,23 @@ export default class Status extends Component { return (
- + + } + /> + } value={ nodeStatus.netChain } { ...this._test('chain') } /> @@ -120,7 +165,12 @@ export default class Status extends Component { + } value={ peers } { ...this._test('peers') } /> @@ -129,7 +179,12 @@ export default class Status extends Component { + } value={ netPort.toString() } { ...this._test('network-port') } /> @@ -139,11 +194,26 @@ export default class Status extends Component { + } value={ rpcSettings.enabled - ? 'yes' - : 'no' + ? ( + + ) + : ( + + ) } { ...this._test('rpc-enabled') } /> @@ -152,7 +222,12 @@ export default class Status extends Component { + } value={ rpcSettings.interface } { ...this._test('rpc-interface') } /> @@ -161,7 +236,12 @@ export default class Status extends Component { + } value={ rpcPort.toString() } { ...this._test('rpc-port') } /> @@ -173,7 +253,12 @@ export default class Status extends Component { + } value={ nodeStatus.enode } { ...this._test('node-enode') } /> diff --git a/js/src/views/Status/status.js b/js/src/views/Status/status.js index ff17bd575..68621fe9b 100644 --- a/js/src/views/Status/status.js +++ b/js/src/views/Status/status.js @@ -15,6 +15,7 @@ // along with Parity. If not, see . import React, { Component } from 'react'; +import { FormattedMessage } from 'react-intl'; import { Page } from '~/ui'; @@ -23,7 +24,14 @@ import StatusPage from './containers/StatusPage'; export default class Status extends Component { render () { return ( - + + } + > ); diff --git a/js/src/views/Wallet/Confirmations/confirmations.js b/js/src/views/Wallet/Confirmations/confirmations.js index fd4d65a12..8f7e6ea52 100644 --- a/js/src/views/Wallet/Confirmations/confirmations.js +++ b/js/src/views/Wallet/Confirmations/confirmations.js @@ -14,8 +14,9 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -import React, { Component, PropTypes } from 'react'; import { LinearProgress, MenuItem, IconMenu } from 'material-ui'; +import React, { Component, PropTypes } from 'react'; +import { FormattedMessage } from 'react-intl'; import ReactTooltip from 'react-tooltip'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; @@ -70,7 +71,12 @@ class WalletConfirmations extends Component { if (realConfirmations.length === 0) { return (
-

No transactions needs confirmation right now.

+

+ +

); } @@ -217,7 +223,12 @@ class WalletConfirmation extends Component { const confirmButton = (
+ - @@ -326,27 +359,27 @@ class WalletConfirmation extends Component { if (value && to && data) { return ( ); } return (
@@ -263,11 +282,15 @@ class WalletConfirmation extends Component { const account = this.props.accounts[address]; return ( - +
{ account.name.toUpperCase() || account.address }
@@ -283,7 +306,10 @@ class WalletConfirmation extends Component { return (
+
- Confirmed by { confirmedBy.length }/{ require.toNumber() } owners +
{ operation } diff --git a/js/src/views/Wallet/Details/details.js b/js/src/views/Wallet/Details/details.js index 0fe7b9257..37e3e9395 100644 --- a/js/src/views/Wallet/Details/details.js +++ b/js/src/views/Wallet/Details/details.js @@ -15,6 +15,7 @@ // along with Parity. If not, see . import React, { Component, PropTypes } from 'react'; +import { FormattedMessage } from 'react-intl'; import { Container, InputAddress } from '~/ui'; @@ -40,7 +41,14 @@ export default class WalletDetails extends Component { return (
- + + } + > { this.renderDetails() } { this.renderOwners() } @@ -62,10 +70,10 @@ export default class WalletDetails extends Component { return ( ); }); @@ -87,9 +95,24 @@ export default class WalletDetails extends Component { return (

- This wallet requires at least - { require.toFormat() } owners - to validate any action (transactions, modifications). + + + + ) + } } + />

); diff --git a/js/src/views/Wallet/Transactions/transactions.js b/js/src/views/Wallet/Transactions/transactions.js index 35d8c03f1..d81c2633a 100644 --- a/js/src/views/Wallet/Transactions/transactions.js +++ b/js/src/views/Wallet/Transactions/transactions.js @@ -15,6 +15,7 @@ // along with Parity. If not, see . import React, { Component, PropTypes } from 'react'; +import { FormattedMessage } from 'react-intl'; import { bytesToHex } from '~/api/util/format'; import { Container } from '~/ui'; @@ -36,7 +37,14 @@ export default class WalletTransactions extends Component { render () { return (
- + + } + > { this.renderTransactions() }
@@ -52,7 +60,12 @@ export default class WalletTransactions extends Component { if (transactions.length === 0) { return (
-

No transactions has been sent.

+

+ +

); } @@ -62,14 +75,17 @@ export default class WalletTransactions extends Component { return ( ); }); diff --git a/js/src/views/Wallet/wallet.js b/js/src/views/Wallet/wallet.js index 55e15dbc9..77f938a78 100644 --- a/js/src/views/Wallet/wallet.js +++ b/js/src/views/Wallet/wallet.js @@ -15,18 +15,15 @@ // along with Parity. If not, see . import React, { Component, PropTypes } from 'react'; +import { FormattedMessage } from 'react-intl'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import moment from 'moment'; -import ContentCreate from 'material-ui/svg-icons/content/create'; -import ActionDelete from 'material-ui/svg-icons/action/delete'; -import ContentSend from 'material-ui/svg-icons/content/send'; -import SettingsIcon from 'material-ui/svg-icons/action/settings'; - -import { nullableProptype } from '~/util/proptypes'; import { EditMeta, Transfer, WalletSettings } from '~/modals'; import { Actionbar, Button, Page, Loading } from '~/ui'; +import { DeleteIcon, EditIcon, SendIcon, SettingsIcon } from '~/ui/Icons'; +import { nullableProptype } from '~/util/proptypes'; import Delete from '../Address/Delete'; import Header from '../Account/Header'; @@ -53,7 +50,10 @@ class WalletContainer extends Component { } return ( - + ); } } @@ -166,11 +166,15 @@ class Wallet extends Component {

- { spent } - has been spent today, out of - { limit } - set as the daily limit, which has been reset on - { date.format('LL') } + { date.format('LL') }, + limit: { limit }, + spent: { spent } + } } + />

); @@ -190,19 +194,19 @@ class Wallet extends Component { return [ , ]; } @@ -216,10 +220,15 @@ class Wallet extends Component { if (owned) { buttons.push(
@@ -146,7 +146,12 @@ class WriteContract extends Component { const { selectedContract } = this.store; if (!selectedContract || !selectedContract.name) { - return 'New Solidity Contract'; + return ( + + ); } return ( @@ -154,9 +159,23 @@ class WriteContract extends Component { { selectedContract.name } + } > - (saved { moment(selectedContract.timestamp).fromNow() }) + ); @@ -176,20 +195,35 @@ class WriteContract extends Component { const buttons = [