From abfa74f09a0119345165a32090d88a1d95df6c80 Mon Sep 17 00:00:00 2001 From: Nick Doiron Date: Mon, 29 Jan 2018 15:29:01 -0500 Subject: [PATCH] complete i18n across new UI --- app/_locales/en/messages.json | 170 +++++++++++------- app/manifest.json | 6 +- ui/app/accounts/import/index.js | 9 +- ui/app/accounts/import/json.js | 8 +- ui/app/accounts/import/private-key.js | 8 +- ui/app/accounts/new-account/create-form.js | 8 +- ui/app/components/account-dropdowns.js | 6 +- ui/app/components/account-export.js | 8 +- ui/app/components/account-menu/index.js | 2 +- ui/app/components/bn-as-decimal-input.js | 9 +- ui/app/components/buy-button-subview.js | 6 +- .../components/customize-gas-modal/index.js | 8 +- .../dropdowns/components/account-dropdowns.js | 8 +- ui/app/components/hex-as-decimal-input.js | 6 +- .../modals/account-details-modal.js | 2 +- .../components/modals/deposit-ether-modal.js | 4 +- .../modals/edit-account-name-modal.js | 4 +- .../modals/hide-token-confirmation-modal.js | 8 +- ui/app/components/modals/new-account-modal.js | 6 +- ui/app/components/pending-msg-details.js | 2 +- .../pending-personal-msg-details.js | 2 +- .../pending-tx/confirm-deploy-contract.js | 12 +- .../pending-tx/confirm-send-ether.js | 6 +- .../pending-tx/confirm-send-token.js | 14 +- .../components/pending-typed-msg-details.js | 2 +- ui/app/components/pending-typed-msg.js | 8 +- ui/app/components/send-token/index.js | 6 +- ui/app/components/shapeshift-form.js | 2 +- ui/app/components/shift-list-item.js | 6 +- ui/app/components/signature-request.js | 8 +- ui/app/components/tx-view.js | 8 +- ui/app/components/wallet-view.js | 4 +- ui/app/css/itcss/generic/index.scss | 4 + ui/i18n.js | 17 +- 34 files changed, 221 insertions(+), 166 deletions(-) diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 54f266318..a0c9088cb 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -3,9 +3,9 @@ "message": "Accept" }, "account": { - "message": "Account:" + "message": "Account" }, - "accDetails": { + "accountDetails": { "message": "Account Details" }, "accountName": { @@ -17,11 +17,14 @@ "addToken": { "message": "Add Token" }, + "amount": { + "message": "Amount" + }, "amountPlusGas": { "message": "Amount + Gas" }, "appDescription": { - "message": "Ethereum Identity Management", + "message": "Ethereum Browser Extension", "description": "The description of the application" }, "appName": { @@ -43,10 +46,14 @@ "balanceIsInsufficientGas": { "message": "Insufficient balance for current gas total" }, + "betweenMinAndMax": { + "message": "must be greater than or equal to $1 and less than or equal to $2.", + "description": "helper for inputting hex as decimal input" + }, "borrowDharma": { "message": "Borrow With Dharma (Beta)" }, - "buyButton": { + "buy": { "message": "Buy" }, "buyCoinbase": { @@ -58,26 +65,20 @@ "cancel": { "message": "Cancel" }, - "cancelCaps": { - "message": "CANCEL" - }, "clickCopy": { "message": "Click to Copy" }, "confirm": { "message": "Confirm" }, - "confirmCaps": { - "message": "CONFIRM" - }, "confirmContract": { "message": "Confirm Contract" }, "confirmPassword": { "message": "Confirm Password" }, - "confirmPasswordSmall": { - "message": "confirm password" + "confirmTransaction": { + "message": "Confirm Transaction" }, "continueToCoinbase": { "message": "Continue to Coinbase" @@ -109,15 +110,19 @@ "copyPrivateKey": { "message": "This is your private key (click to copy)" }, + "create": { + "message": "Create" + }, "createAccount": { "message": "Create Account" }, - "createCaps": { - "message": "CREATE" - }, "createDen": { "message": "Create" }, + "crypto": { + "message": "Crypto", + "description": "Exchange type (cryptocurrencies)" + }, "customGas": { "message": "Customize Gas" }, @@ -139,9 +144,6 @@ "depositBTC": { "message": "Deposit your BTC to the address below:" }, - "depositButton": { - "message": "DEPOSIT" - }, "depositEth": { "message": "Deposit Eth" }, @@ -160,8 +162,8 @@ "depositShapeShiftExplainer": { "message": "If you own other cryptocurrencies, you can trade and deposit Ether directly into your MetaMask wallet. No Account Needed." }, - "detailsCaps": { - "message": "DETAILS" + "details": { + "message": "Details" }, "directDeposit": { "message": "Direct Deposit" @@ -175,12 +177,12 @@ "done": { "message": "Done" }, + "edit": { + "message": "Edit" + }, "editAccountName": { "message": "Edit Account Name" }, - "editCaps": { - "message": "EDIT" - }, "encryptNewDen": { "message": "Encrypt your new DEN" }, @@ -196,17 +198,19 @@ "exportPrivateKey": { "message": "Export Private Key" }, - "exportPrivateKeyLower": { - "message": "Export private key" - }, "exportPrivateKeyWarning": { "message": "Export private keys at your own risk." }, "failed": { "message": "Failed" }, + "fiat": { + "message": "FIAT", + "description": "Exchange type" + }, "fileImportFail": { - "message": "File import not working? Click here!" + "message": "File import not working? Click here!", + "description": "Helps user import their account from a JSON file" }, "from": { "message": "From" @@ -214,12 +218,13 @@ "fromShapeShift": { "message": "From ShapeShift" }, + "gas": { + "message": "Gas", + "description": "Short indication of gas cost" + }, "gasFee": { "message": "Gas Fee" }, - "gasFeeSpecific": { - "message": "Gas fee:" - }, "gasLimit": { "message": "Gas Limit" }, @@ -244,11 +249,20 @@ "getEther": { "message": "Get Ether" }, - "here": { - "message": "here" + "getEtherFromFaucet": { + "message": "Get Ether from a faucet for the $1", + "description": "Displays network name for Ether faucet" }, - "hideCaps": { - "message": "HIDE" + "greaterThanMin": { + "message": "must be greater than or equal to $1.", + "description": "helper for inputting hex as decimal input" + }, + "here": { + "message": "here", + "description": "as in -click here- for more information (goes with troubleTokenBalances)" + }, + "hide": { + "message": "Hide" }, "hideToken": { "message": "Hide Token" @@ -260,7 +274,8 @@ "message": "How would you like to deposit Ether?" }, "import": { - "message": "Import" + "message": "Import", + "description": "Button to import an account from a selected file" }, "importAccount": { "message": "Import Account" @@ -268,14 +283,12 @@ "importAnAccount": { "message": "Import an account" }, - "importCaps": { - "message": "IMPORT" - }, "importDen": { "message": "Import Existing DEN" }, - "importedCaps": { - "message": "IMPORTED" + "imported": { + "message": "Imported", + "description": "status showing that an account has been fully loaded into the keyring" }, "infoHelp": { "message": "Info & Help" @@ -292,9 +305,17 @@ "invalidRequest": { "message": "Invalid Request" }, + "jsonFile": { + "message": "JSON File", + "description": "format for importing an account" + }, "kovan": { "message": "Kovan Test Network" }, + "lessThanMax": { + "message": "must be less than or equal to $1.", + "description": "helper for inputting hex as decimal input" + }, "limit": { "message": "Limit" }, @@ -310,8 +331,8 @@ "logout": { "message": "Log out" }, - "looseCaps": { - "message": "LOOSE" + "loose": { + "message": "Loose" }, "mainnet": { "message": "Main Ethereum Network" @@ -319,9 +340,6 @@ "message": { "message": "Message" }, - "messageCaps": { - "message": "MESSAGE" - }, "min": { "message": "Minimum" }, @@ -332,10 +350,12 @@ "message": "To interact with decentralized applications using MetaMask, you’ll need Ether in your wallet." }, "needImportFile": { - "message": "You must select a file to import." + "message": "You must select a file to import.", + "description": "User is important an account and needs to add a file to continue" }, "needImportPassword": { - "message": "You must enter a password for the selected file." + "message": "You must enter a password for the selected file.", + "description": "Password and file needed to import an account" }, "networks": { "message": "Networks" @@ -377,20 +397,28 @@ "message": "You have returned to the old UI. You can switch back to the New UI through the option in the top right dropdown menu." }, "or": { - "message": "or" + "message": "or", + "description": "choice between creating or importing a new account" }, "passwordMismatch": { - "message": "passwords don't match" + "message": "passwords don't match", + "description": "in password creation process, the two new password fields did not match" }, "passwordShort": { - "message": "password not long enough" + "message": "password not long enough", + "description": "in password creation process, the password is not long enough to be secure" }, "pastePrivateKey": { - "message": "Paste your private key string here:" + "message": "Paste your private key string here:", + "description": "For importing an account from a private key" }, "pasteSeed": { "message": "Paste your seed phrase here!" }, + "privateKey": { + "message": "Private Key", + "description": "select this type of file to use to import an account" + }, "privateKeyWarning": { "message": "Warning: Never disclose this key. Anyone with your private keys can take steal any assets held in your account." }, @@ -434,16 +462,21 @@ "message": "Ropsten Test Network" }, "sampleAccountName": { - "message": "E.g. My new account" + "message": "E.g. My new account", + "description": "Help user understand concept of adding a human-readable name to their account" }, - "saveCaps": { - "message": "SAVE" + "save": { + "message": "Save" + }, + "saveAsFile": { + "message": "Save as File", + "description": "Account export process" }, "selectService": { "message": "Select Service" }, - "sendButton": { - "message": "SEND" + "send": { + "message": "Send" }, "sendTokens": { "message": "Send Tokens" @@ -460,12 +493,12 @@ "showPrivateKeys": { "message": "Show Private Keys" }, + "showQRCode": { + "message": "Show QR Code" + }, "sign": { "message": "Sign" }, - "signCaps": { - "message": "SIGN" - }, "signMessage": { "message": "Sign Message" }, @@ -490,12 +523,13 @@ "to": { "message": "To" }, + "toETHviaShapeShift": { + "message": "$1 to ETH via ShapeShift", + "description": "system will fill in deposit type in start of message" + }, "tokenBalance": { "message": "Your Token Balance is:" }, - "toSpecific": { - "message": "To:" - }, "total": { "message": "Total" }, @@ -509,7 +543,8 @@ "message": "Transfers" }, "troubleTokenBalances": { - "message": "We had trouble loading your token balances. You can view them " + "message": "We had trouble loading your token balances. You can view them ", + "description": "Followed by a link (here) to view token balances" }, "typePassword": { "message": "Type Your Password" @@ -532,6 +567,10 @@ "unknownNetworkId": { "message": "Unknown network ID" }, + "usaOnly": { + "message": "USA only", + "description": "Using this exchange is limited to people inside the USA" + }, "usedByClients": { "message": "Used by a variety of different clients" }, @@ -548,9 +587,6 @@ "message": "Your signature is being requested" }, "youSign": { - "message": "You are signing:" - }, - "youSignCaps": { - "message": "YOU ARE SIGNING" + "message": "You are signing" } } diff --git a/app/manifest.json b/app/manifest.json index d906382e9..b52d3245d 100644 --- a/app/manifest.json +++ b/app/manifest.json @@ -1,10 +1,10 @@ { - "name": "MetaMask", - "short_name": "Metamask", + "name": "__MSG_appName__", + "short_name": "__MSG_appName__", "version": "4.0.10", "manifest_version": 2, "author": "https://metamask.io", - "description": "Ethereum Browser Extension", + "description": "__MSG_appDescription__", "commands": { "_execute_browser_action": { "suggested_key": { diff --git a/ui/app/accounts/import/index.js b/ui/app/accounts/import/index.js index 0c901c09b..6ae74864f 100644 --- a/ui/app/accounts/import/index.js +++ b/ui/app/accounts/import/index.js @@ -2,6 +2,7 @@ const inherits = require('util').inherits const Component = require('react').Component const h = require('react-hyperscript') const connect = require('react-redux').connect +const t = require('../../../i18n') import Select from 'react-select' // Subviews @@ -9,8 +10,8 @@ const JsonImportView = require('./json.js') const PrivateKeyImportView = require('./private-key.js') const menuItems = [ - 'Private Key', - 'JSON File', + t('privateKey'), + t('jsonFile'), ] module.exports = connect(mapStateToProps)(AccountImportSubview) @@ -70,9 +71,9 @@ AccountImportSubview.prototype.renderImportView = function () { const current = type || menuItems[0] switch (current) { - case 'Private Key': + case t('privateKey'): return h(PrivateKeyImportView) - case 'JSON File': + case t('jsonFile'): return h(JsonImportView) default: return h(JsonImportView) diff --git a/ui/app/accounts/import/json.js b/ui/app/accounts/import/json.js index 8b5a2b469..eb63a98a9 100644 --- a/ui/app/accounts/import/json.js +++ b/ui/app/accounts/import/json.js @@ -50,16 +50,16 @@ JsonImportSubview.prototype.render = function () { h('div.new-account-create-form__buttons', {}, [ - h('button.new-account-create-form__button-cancel', { + h('button.new-account-create-form__button-cancel.allcaps', { onClick: () => this.props.goHome(), }, [ - t('cancelCaps'), + t('cancel'), ]), - h('button.new-account-create-form__button-create', { + h('button.new-account-create-form__button-create.allcaps', { onClick: () => this.createNewKeychain.bind(this), }, [ - t('importCaps'), + t('import'), ]), ]), diff --git a/ui/app/accounts/import/private-key.js b/ui/app/accounts/import/private-key.js index 4a04156e0..e8c192a61 100644 --- a/ui/app/accounts/import/private-key.js +++ b/ui/app/accounts/import/private-key.js @@ -43,16 +43,16 @@ PrivateKeyImportView.prototype.render = function () { h('div.new-account-create-form__buttons', {}, [ - h('button.new-account-create-form__button-cancel', { + h('button.new-account-create-form__button-cancel.allcaps', { onClick: () => goHome(), }, [ - t('cancelCaps'), + t('cancel'), ]), - h('button.new-account-create-form__button-create', { + h('button.new-account-create-form__button-create.allcaps', { onClick: () => this.createNewKeychain(), }, [ - t('importCaps'), + t('import'), ]), ]), diff --git a/ui/app/accounts/new-account/create-form.js b/ui/app/accounts/new-account/create-form.js index 6f35e8886..ce8af394a 100644 --- a/ui/app/accounts/new-account/create-form.js +++ b/ui/app/accounts/new-account/create-form.js @@ -35,16 +35,16 @@ class NewAccountCreateForm extends Component { h('div.new-account-create-form__buttons', {}, [ - h('button.new-account-create-form__button-cancel', { + h('button.new-account-create-form__button-cancel.allcaps', { onClick: () => this.props.goHome(), }, [ - t('cancelCaps'), + t('cancel'), ]), - h('button.new-account-create-form__button-create', { + h('button.new-account-create-form__button-create.allcaps', { onClick: () => this.props.createAccount(newAccountName), }, [ - t('createCaps'), + t('create'), ]), ]), diff --git a/ui/app/components/account-dropdowns.js b/ui/app/components/account-dropdowns.js index ede40d3f2..e92da8947 100644 --- a/ui/app/components/account-dropdowns.js +++ b/ui/app/components/account-dropdowns.js @@ -80,7 +80,7 @@ class AccountDropdowns extends Component { try { // Sometimes keyrings aren't loaded yet: const type = keyring.type const isLoose = type !== 'HD Key Tree' - return isLoose ? h('.keyring-label', t('looseCaps')) : null + return isLoose ? h('.keyring-label.allcaps', t('loose')) : null } catch (e) { return } } @@ -155,7 +155,7 @@ class AccountDropdowns extends Component { fontSize: '24px', marginBottom: '5px', }, - }, 'Import Account'), + }, t('importAccount')), ] ), ] @@ -205,7 +205,7 @@ class AccountDropdowns extends Component { actions.showQrView(selected, identity ? identity.name : '') }, }, - t('qrCode'), + t('showQRCode'), ), h( DropdownMenuItem, diff --git a/ui/app/components/account-export.js b/ui/app/components/account-export.js index 25f36da58..5637bc8d0 100644 --- a/ui/app/components/account-export.js +++ b/ui/app/components/account-export.js @@ -54,7 +54,7 @@ ExportAccountView.prototype.render = function () { h('p.error', warning), h('input#exportAccount.sizing-input', { type: 'password', - placeholder: t('confirmPasswordSmall'), + placeholder: t('confirmPassword').toLowerCase(), onKeyPress: this.onExportKeyPress.bind(this), style: { position: 'relative', @@ -99,7 +99,7 @@ ExportAccountView.prototype.render = function () { margin: '0 20px', }, }, [ - h('label', 'Your private key (click to copy):'), + h('label', t('copyPrivateKey') + ':'), h('p.error.cursor-pointer', { style: { textOverflow: 'ellipsis', @@ -113,13 +113,13 @@ ExportAccountView.prototype.render = function () { }, plainKey), h('button', { onClick: () => this.props.dispatch(actions.backToAccountDetail(this.props.address)), - }, 'Done'), + }, t('done')), h('button', { style: { marginLeft: '10px', }, onClick: () => exportAsFile(`MetaMask ${nickname} Private Key`, plainKey), - }, 'Save as File'), + }, t('saveAsFile')), ]) } } diff --git a/ui/app/components/account-menu/index.js b/ui/app/components/account-menu/index.js index 9c7b6b15a..d9cf8cdce 100644 --- a/ui/app/components/account-menu/index.js +++ b/ui/app/components/account-menu/index.js @@ -156,6 +156,6 @@ AccountMenu.prototype.indicateIfLoose = function (keyring) { try { // Sometimes keyrings aren't loaded yet: const type = keyring.type const isLoose = type !== 'HD Key Tree' - return isLoose ? h('.keyring-label', t('importedCaps')) : null + return isLoose ? h('.keyring-label.allcaps', t('imported')) : null } catch (e) { return } } diff --git a/ui/app/components/bn-as-decimal-input.js b/ui/app/components/bn-as-decimal-input.js index 22e37602e..70701b039 100644 --- a/ui/app/components/bn-as-decimal-input.js +++ b/ui/app/components/bn-as-decimal-input.js @@ -4,6 +4,7 @@ const inherits = require('util').inherits const ethUtil = require('ethereumjs-util') const BN = ethUtil.BN const extend = require('xtend') +const t = require('../../i18n') module.exports = BnAsDecimalInput @@ -136,13 +137,13 @@ BnAsDecimalInput.prototype.constructWarning = function () { let message = name ? name + ' ' : '' if (min && max) { - message += `must be greater than or equal to ${newMin} ${suffix} and less than or equal to ${newMax} ${suffix}.` + message += t('betweenMinAndMax', [`${newMin} ${suffix}`, `${newMax} ${suffix}`]) } else if (min) { - message += `must be greater than or equal to ${newMin} ${suffix}.` + message += t('greaterThanMin', [`${newMin} ${suffix}`]) } else if (max) { - message += `must be less than or equal to ${newMax} ${suffix}.` + message += t('lessThanMax', [`${newMax} ${suffix}`]) } else { - message += 'Invalid input.' + message += t('invalidInput') } return message diff --git a/ui/app/components/buy-button-subview.js b/ui/app/components/buy-button-subview.js index 6f2c74b6d..1e277a94b 100644 --- a/ui/app/components/buy-button-subview.js +++ b/ui/app/components/buy-button-subview.js @@ -144,7 +144,7 @@ BuyButtonSubview.prototype.primarySubview = function () { case '4': case '42': const networkName = networkNames[network] - const label = `${networkName} Test Faucet` + const label = `${networkName} ${t('testFaucet')}` return ( h('div.flex-column', { style: { @@ -204,8 +204,8 @@ BuyButtonSubview.prototype.mainnetSubview = function () { 'ShapeShift', ], subtext: { - 'Coinbase': 'Crypto/FIAT (USA only)', - 'ShapeShift': 'Crypto', + 'Coinbase': `${t('crypto')}/${t('fiat')} (${t('usaOnly')})`, + 'ShapeShift': t('crypto'), }, onClick: this.radioHandler.bind(this), }), diff --git a/ui/app/components/customize-gas-modal/index.js b/ui/app/components/customize-gas-modal/index.js index 1c6036867..920dfeab6 100644 --- a/ui/app/components/customize-gas-modal/index.js +++ b/ui/app/components/customize-gas-modal/index.js @@ -283,13 +283,13 @@ CustomizeGasModal.prototype.render = function () { }, [t('revert')]), h('div.send-v2__customize-gas__buttons', [ - h('div.send-v2__customize-gas__cancel', { + h('div.send-v2__customize-gas__cancel.allcaps', { onClick: this.props.hideModal, - }, [t('cancelCaps')]), + }, [t('cancel')]), - h(`div.send-v2__customize-gas__save${error ? '__error' : ''}`, { + h(`div.send-v2__customize-gas__save${error ? '__error' : ''}.allcaps`, { onClick: () => !error && this.save(gasPrice, gasLimit, gasTotal), - }, [t('saveCaps')]), + }, [t('save')]), ]), ]), diff --git a/ui/app/components/dropdowns/components/account-dropdowns.js b/ui/app/components/dropdowns/components/account-dropdowns.js index dfa5e5fac..620ac8483 100644 --- a/ui/app/components/dropdowns/components/account-dropdowns.js +++ b/ui/app/components/dropdowns/components/account-dropdowns.js @@ -122,7 +122,7 @@ class AccountDropdowns extends Component { flex: '3 3 auto', }, }, [ - h('span.account-dropdown-edit-button', { + h('span.account-dropdown-edit-button.allcaps', { style: { fontSize: '16px', }, @@ -130,7 +130,7 @@ class AccountDropdowns extends Component { actions.showEditAccountModal(identity) }, }, [ - t('editCaps'), + t('edit'), ]), ]), @@ -160,7 +160,7 @@ class AccountDropdowns extends Component { try { // Sometimes keyrings aren't loaded yet: const type = keyring.type const isLoose = type !== 'HD Key Tree' - return isLoose ? h('.keyring-label', t('looseCaps')) : null + return isLoose ? h('.keyring-label.allcaps', t('loose')) : null } catch (e) { return } } @@ -303,7 +303,7 @@ class AccountDropdowns extends Component { menuItemStyles, ), }, - t('accDetails'), + t('accountDetails'), ), h( DropdownMenuItem, diff --git a/ui/app/components/hex-as-decimal-input.js b/ui/app/components/hex-as-decimal-input.js index 992d8c8cd..a43d44f89 100644 --- a/ui/app/components/hex-as-decimal-input.js +++ b/ui/app/components/hex-as-decimal-input.js @@ -127,11 +127,11 @@ HexAsDecimalInput.prototype.constructWarning = function () { let message = name ? name + ' ' : '' if (min && max) { - message += `must be greater than or equal to ${min} and less than or equal to ${max}.` + message += t('betweenMinAndMax', [min, max]) } else if (min) { - message += `must be greater than or equal to ${min}.` + message += t('greaterThanMin', [min]) } else if (max) { - message += `must be less than or equal to ${max}.` + message += t('lessThanMax', [max]) } else { message += t('invalidInput') } diff --git a/ui/app/components/modals/account-details-modal.js b/ui/app/components/modals/account-details-modal.js index 17760dc1a..75f989e86 100644 --- a/ui/app/components/modals/account-details-modal.js +++ b/ui/app/components/modals/account-details-modal.js @@ -70,7 +70,7 @@ AccountDetailsModal.prototype.render = function () { // Holding on redesign for Export Private Key functionality h('button.btn-clear.account-modal__button', { onClick: () => showExportPrivateKeyModal(), - }, t('exportPrivateKeyLower')), + }, t('exportPrivateKey')), ]) } diff --git a/ui/app/components/modals/deposit-ether-modal.js b/ui/app/components/modals/deposit-ether-modal.js index e91b43841..7172d05a5 100644 --- a/ui/app/components/modals/deposit-ether-modal.js +++ b/ui/app/components/modals/deposit-ether-modal.js @@ -14,7 +14,9 @@ const COINBASE_ROW_TEXT = t('buyCoinbaseExplainer') const SHAPESHIFT_ROW_TITLE = t('depositShapeShift') const SHAPESHIFT_ROW_TEXT = t('depositShapeShiftExplainer') const FAUCET_ROW_TITLE = t('testFaucet') -const facuetRowText = networkName => `Get Ether from a faucet for the ${networkName}` +const facuetRowText = (networkName) => { + return t('getEtherFromFaucet', [networkName]) +} function mapStateToProps (state) { return { diff --git a/ui/app/components/modals/edit-account-name-modal.js b/ui/app/components/modals/edit-account-name-modal.js index 611def005..6efa8d476 100644 --- a/ui/app/components/modals/edit-account-name-modal.js +++ b/ui/app/components/modals/edit-account-name-modal.js @@ -61,7 +61,7 @@ EditAccountNameModal.prototype.render = function () { value: this.state.inputText, }, []), - h('button.btn-clear.edit-account-name-modal-save-button', { + h('button.btn-clear.edit-account-name-modal-save-button.allcaps', { onClick: () => { if (this.state.inputText.length !== 0) { saveAccountLabel(identity.address, this.state.inputText) @@ -70,7 +70,7 @@ EditAccountNameModal.prototype.render = function () { }, disabled: this.state.inputText.length === 0, }, [ - t('saveCaps'), + t('save'), ]), ]), diff --git a/ui/app/components/modals/hide-token-confirmation-modal.js b/ui/app/components/modals/hide-token-confirmation-modal.js index 98b1e2d03..33d8062c6 100644 --- a/ui/app/components/modals/hide-token-confirmation-modal.js +++ b/ui/app/components/modals/hide-token-confirmation-modal.js @@ -59,15 +59,15 @@ HideTokenConfirmationModal.prototype.render = function () { ]), h('div.hide-token-confirmation__buttons', {}, [ - h('button.btn-cancel.hide-token-confirmation__button', { + h('button.btn-cancel.hide-token-confirmation__button.allcaps', { onClick: () => hideModal(), }, [ - t('cancelCaps'), + t('cancel'), ]), - h('button.btn-clear.hide-token-confirmation__button', { + h('button.btn-clear.hide-token-confirmation__button.allcaps', { onClick: () => hideToken(address), }, [ - t('hideCaps'), + t('hide'), ]), ]), ]), diff --git a/ui/app/components/modals/new-account-modal.js b/ui/app/components/modals/new-account-modal.js index 35f4764a6..298b76af4 100644 --- a/ui/app/components/modals/new-account-modal.js +++ b/ui/app/components/modals/new-account-modal.js @@ -12,7 +12,7 @@ class NewAccountModal extends Component { const newAccountNumber = numberOfExistingAccounts + 1 this.state = { - newAccountName: `Account ${newAccountNumber}`, + newAccountName: `${t('account')} ${newAccountNumber}`, } } @@ -53,11 +53,11 @@ class NewAccountModal extends Component { }, }, t('importAnAccount')), - h('div.new-account-modal-content.button', {}, [ + h('div.new-account-modal-content.button.allcaps', {}, [ h('button.btn-clear', { onClick: () => this.props.createAccount(newAccountName), }, [ - t('saveCaps'), + t('save'), ]), ]), ]), diff --git a/ui/app/components/pending-msg-details.js b/ui/app/components/pending-msg-details.js index b66657f3b..87e66855d 100644 --- a/ui/app/components/pending-msg-details.js +++ b/ui/app/components/pending-msg-details.js @@ -40,7 +40,7 @@ PendingMsgDetails.prototype.render = function () { // message data h('.tx-data.flex-column.flex-justify-center.flex-grow.select-none', [ h('.flex-column.flex-space-between', [ - h('label.font-small', t('messageCaps')), + h('label.font-small.allcaps', t('message')), h('span.font-small', msgParams.data), ]), ]), diff --git a/ui/app/components/pending-personal-msg-details.js b/ui/app/components/pending-personal-msg-details.js index d21689f86..b896e9a7e 100644 --- a/ui/app/components/pending-personal-msg-details.js +++ b/ui/app/components/pending-personal-msg-details.js @@ -46,7 +46,7 @@ PendingMsgDetails.prototype.render = function () { height: '260px', }, }, [ - h('label.font-small', { style: { display: 'block' } }, t('messageCaps')), + h('label.font-small.allcaps', { style: { display: 'block' } }, t('message')), h(BinaryRenderer, { value: data, style: { diff --git a/ui/app/components/pending-tx/confirm-deploy-contract.js b/ui/app/components/pending-tx/confirm-deploy-contract.js index e6972c541..49fbe6387 100644 --- a/ui/app/components/pending-tx/confirm-deploy-contract.js +++ b/ui/app/components/pending-tx/confirm-deploy-contract.js @@ -56,7 +56,7 @@ ConfirmDeployContract.prototype.onSubmit = function (event) { if (valid && this.verifyGasParams()) { this.props.sendTransaction(txMeta, event) } else { - this.props.dispatch(actions.displayWarning('Invalid Gas Parameters')) + this.props.dispatch(actions.displayWarning(t('invalidGasParams'))) this.setState({ submitting: false }) } } @@ -272,9 +272,9 @@ ConfirmDeployContract.prototype.render = function () { // Main Send token Card h('div.confirm-screen-wrapper.flex-column.flex-grow', [ h('h3.flex-center.confirm-screen-header', [ - h('button.confirm-screen-back-button', { + h('button.confirm-screen-back-button.allcaps', { onClick: () => backToAccountDetail(selectedAddress), - }, 'BACK'), + }, t('back')), h('div.confirm-screen-title', t('confirmContract')), h('div.confirm-screen-header-tip'), ]), @@ -336,12 +336,12 @@ ConfirmDeployContract.prototype.render = function () { onSubmit: this.onSubmit, }, [ // Cancel Button - h('div.cancel.btn-light.confirm-screen-cancel-button', { + h('div.cancel.btn-light.confirm-screen-cancel-button.allcaps', { onClick: (event) => this.cancel(event, txMeta), - }, t('cancelCaps')), + }, t('cancel')), // Accept Button - h('button.confirm-screen-confirm-button', [t('confirmCaps')]), + h('button.confirm-screen-confirm-button.allcaps', [t('confirm')]), ]), ]) diff --git a/ui/app/components/pending-tx/confirm-send-ether.js b/ui/app/components/pending-tx/confirm-send-ether.js index 52693b4f6..21b9b548b 100644 --- a/ui/app/components/pending-tx/confirm-send-ether.js +++ b/ui/app/components/pending-tx/confirm-send-ether.js @@ -392,15 +392,15 @@ ConfirmSendEther.prototype.render = function () { onSubmit: this.onSubmit, }, [ // Cancel Button - h('div.cancel.btn-light.confirm-screen-cancel-button', { + h('div.cancel.btn-light.confirm-screen-cancel-button.allcaps', { onClick: (event) => { clearSend() this.cancel(event, txMeta) }, - }, t('cancelCaps')), + }, t('cancel')), // Accept Button - h('button.confirm-screen-confirm-button', [t('confirmCaps')]), + h('button.confirm-screen-confirm-button.allcaps', [t('confirm')]), ]), ]) ) diff --git a/ui/app/components/pending-tx/confirm-send-token.js b/ui/app/components/pending-tx/confirm-send-token.js index 14523461f..b1bec946a 100644 --- a/ui/app/components/pending-tx/confirm-send-token.js +++ b/ui/app/components/pending-tx/confirm-send-token.js @@ -286,7 +286,7 @@ ConfirmSendToken.prototype.renderTotalPlusGas = function () { h('div.confirm-screen-section-column', [ h('div.confirm-screen-row-info', `${tokenAmount} ${symbol}`), - h('div.confirm-screen-row-detail', `+ ${fiatGas} ${currentCurrency} Gas`), + h('div.confirm-screen-row-detail', `+ ${fiatGas} ${currentCurrency} ${t('gas')}`), ]), ]) ) @@ -315,10 +315,10 @@ ConfirmSendToken.prototype.render = function () { // Main Send token Card h('div.confirm-screen-wrapper.flex-column.flex-grow', [ h('h3.flex-center.confirm-screen-header', [ - h('button.btn-clear.confirm-screen-back-button', { + h('button.btn-clear.confirm-screen-back-button.allcaps', { onClick: () => editTransaction(txMeta), - }, t('editCaps')), - h('div.confirm-screen-title', 'Confirm Transaction'), + }, t('edit')), + h('div.confirm-screen-title', t('confirmTransaction')), h('div.confirm-screen-header-tip'), ]), h('div.flex-row.flex-center.confirm-screen-identicons', [ @@ -386,12 +386,12 @@ ConfirmSendToken.prototype.render = function () { onSubmit: this.onSubmit, }, [ // Cancel Button - h('div.cancel.btn-light.confirm-screen-cancel-button', { + h('div.cancel.btn-light.confirm-screen-cancel-button.allcaps', { onClick: (event) => this.cancel(event, txMeta), - }, t('cancelCaps')), + }, t('cancel')), // Accept Button - h('button.confirm-screen-confirm-button', [t('confirmCaps')]), + h('button.confirm-screen-confirm-button.allcaps', [t('confirm')]), ]), diff --git a/ui/app/components/pending-typed-msg-details.js b/ui/app/components/pending-typed-msg-details.js index 9708ed1d7..ae0a1171e 100644 --- a/ui/app/components/pending-typed-msg-details.js +++ b/ui/app/components/pending-typed-msg-details.js @@ -46,7 +46,7 @@ PendingMsgDetails.prototype.render = function () { height: '260px', }, }, [ - h('label.font-small', { style: { display: 'block' } }, t('youSignCaps')), + h('label.font-small.allcaps', { style: { display: 'block' } }, t('youSign')), h(TypedMessageRenderer, { value: data, style: { diff --git a/ui/app/components/pending-typed-msg.js b/ui/app/components/pending-typed-msg.js index 3d473f47d..ccde5e8af 100644 --- a/ui/app/components/pending-typed-msg.js +++ b/ui/app/components/pending-typed-msg.js @@ -34,12 +34,12 @@ PendingMsg.prototype.render = function () { // sign + cancel h('.flex-row.flex-space-around', [ - h('button', { + h('button.allcaps', { onClick: state.cancelTypedMessage, - }, t('cancelCaps')), - h('button', { + }, t('cancel')), + h('button.allcaps', { onClick: state.signTypedMessage, - }, t('signCaps')), + }, t('sign')), ]), ]) diff --git a/ui/app/components/send-token/index.js b/ui/app/components/send-token/index.js index 2ad7c9dd0..58743b641 100644 --- a/ui/app/components/send-token/index.js +++ b/ui/app/components/send-token/index.js @@ -234,7 +234,7 @@ SendTokenScreen.prototype.renderToAddressInput = function () { 'send-screen-input-wrapper--error': errorMessage, }), }, [ - h('div', [t('toSpecific')]), + h('div', [t('to') + ':']), h('input.large-input.send-screen-input', { name: 'address', list: 'addresses', @@ -291,7 +291,7 @@ SendTokenScreen.prototype.renderAmountInput = function () { }), }, [ h('div.send-screen-amount-labels', [ - h('span', ['Amount']), + h('span', [t('amount')]), h(CurrencyToggle, { currentCurrency: tokenExchangeRate ? selectedCurrency : 'USD', currencies: tokenExchangeRate ? [ symbol, 'USD' ] : [], @@ -356,7 +356,7 @@ SendTokenScreen.prototype.renderGasInput = function () { }), h('div.send-screen-gas-labels', {}, [ - h('span', [ h('i.fa.fa-bolt'), t('gasFeeSpecific')]), + h('span', [ h('i.fa.fa-bolt'), t('gasFee') + ':']), h('span', [t('whatsThis')]), ]), h('div.large-input.send-screen-gas-input', [ diff --git a/ui/app/components/shapeshift-form.js b/ui/app/components/shapeshift-form.js index 329feb38f..104f82224 100644 --- a/ui/app/components/shapeshift-form.js +++ b/ui/app/components/shapeshift-form.js @@ -237,7 +237,7 @@ ShapeshiftForm.prototype.render = function () { className: btnClass, disabled: !token, onClick: () => this.onBuyWithShapeShift(), - }, [t('buyButton')]), + }, [t('buy')]), ]) } diff --git a/ui/app/components/shift-list-item.js b/ui/app/components/shift-list-item.js index 21d41a06c..0d8681fb7 100644 --- a/ui/app/components/shift-list-item.js +++ b/ui/app/components/shift-list-item.js @@ -81,7 +81,7 @@ ShiftListItem.prototype.renderUtilComponents = function () { value: this.props.depositAddress, }), h(Tooltip, { - title: 'QR Code', + title: t('qrCode'), }, [ h('i.fa.fa-qrcode.pointer.pop-hover', { onClick: () => props.dispatch(actions.reshowQrCode(props.depositAddress, props.depositType)), @@ -141,7 +141,7 @@ ShiftListItem.prototype.renderInfo = function () { color: '#ABA9AA', width: '100%', }, - }, `${props.depositType} to ETH via ShapeShift`), + }, t('toETHviaShapeShift', [props.depositType])), h('div', t('noDeposits')), h('div', { style: { @@ -164,7 +164,7 @@ ShiftListItem.prototype.renderInfo = function () { color: '#ABA9AA', width: '100%', }, - }, `${props.depositType} to ETH via ShapeShift`), + }, t('toETHviaShapeShift', [props.depositType])), h('div', t('conversionProgress')), h('div', { style: { diff --git a/ui/app/components/signature-request.js b/ui/app/components/signature-request.js index d0e568bca..7bf34e7b6 100644 --- a/ui/app/components/signature-request.js +++ b/ui/app/components/signature-request.js @@ -76,7 +76,7 @@ SignatureRequest.prototype.renderAccountDropdown = function () { return h('div.request-signature__account', [ - h('div.request-signature__account-text', [t('account')]), + h('div.request-signature__account-text', [t('account') + ':']), h(AccountDropdownMini, { selectedAccount, @@ -155,7 +155,7 @@ SignatureRequest.prototype.msgHexToText = function (hex) { SignatureRequest.prototype.renderBody = function () { let rows - let notice = t('youSign') + let notice = t('youSign') + ':' const { txData } = this.props const { type, msgParams: { data } } = txData @@ -225,10 +225,10 @@ SignatureRequest.prototype.renderFooter = function () { return h('div.request-signature__footer', [ h('button.request-signature__footer__cancel-button', { onClick: cancel, - }, t('cancelCaps')), + }, t('cancel')), h('button.request-signature__footer__sign-button', { onClick: sign, - }, t('signCaps')), + }, t('sign')), ]) } diff --git a/ui/app/components/tx-view.js b/ui/app/components/tx-view.js index adc9b8e94..d35d20a89 100644 --- a/ui/app/components/tx-view.js +++ b/ui/app/components/tx-view.js @@ -69,25 +69,25 @@ TxView.prototype.renderButtons = function () { return !selectedToken ? ( h('div.flex-row.flex-center.hero-balance-buttons', [ - h('button.btn-clear.hero-balance-button', { + h('button.btn-clear.hero-balance-button.allcaps', { onClick: () => showModal({ name: 'DEPOSIT_ETHER', }), - }, t('depositButton')), + }, t('deposit')), h('button.btn-clear.hero-balance-button', { style: { marginLeft: '0.8em', }, onClick: showSendPage, - }, t('sendButton')), + }, t('send')), ]) ) : ( h('div.flex-row.flex-center.hero-balance-buttons', [ h('button.btn-clear.hero-balance-button', { onClick: showSendTokenPage, - }, t('sendButton')), + }, t('send')), ]) ) } diff --git a/ui/app/components/wallet-view.js b/ui/app/components/wallet-view.js index 60a780fc6..6bd2d0963 100644 --- a/ui/app/components/wallet-view.js +++ b/ui/app/components/wallet-view.js @@ -114,7 +114,7 @@ WalletView.prototype.render = function () { onClick: hideSidebar, }), - h('div.wallet-view__keyring-label', isLoose ? t('importedCaps') : ''), + h('div.wallet-view__keyring-label.allcaps', isLoose ? t('imported') : ''), h('div.flex-column.flex-center.wallet-view__name-container', { style: { margin: '0 auto' }, @@ -131,7 +131,7 @@ WalletView.prototype.render = function () { selectedIdentity.name, ]), - h('button.btn-clear.wallet-view__details-button', t('detailsCaps')), + h('button.btn-clear.wallet-view__details-button.allcaps', t('details')), ]), ]), diff --git a/ui/app/css/itcss/generic/index.scss b/ui/app/css/itcss/generic/index.scss index 9d55324e3..91c85f073 100644 --- a/ui/app/css/itcss/generic/index.scss +++ b/ui/app/css/itcss/generic/index.scss @@ -69,3 +69,7 @@ textarea.large-input { input.large-input { height: 36px; } + +.allcaps { + text-transform: uppercase; +} diff --git a/ui/i18n.js b/ui/i18n.js index 0f4e9fce4..db79c87e8 100644 --- a/ui/i18n.js +++ b/ui/i18n.js @@ -11,9 +11,20 @@ if ((chrome && chrome.i18n && chrome.i18n.getMessage) || } else { // fallback function console.warn('browser.i18n API not available?') - let msg = require('../app/_locales/en/messages.json') - getMessage = function (key) { - return msg[key].message + const msg = require('../app/_locales/en/messages.json') + getMessage = function (key, substitutions) { + if (!msg[key]) { + console.error(key) + throw new Error(key) + } + let phrase = msg[key].message + if (substitutions && substitutions.length) { + phrase = phrase.replace(/\$1/g, substitutions[0]) + if (substitutions.length > 1) { + phrase = phrase.replace(/\$2/g, substitutions[1]) + } + } + return phrase } }