From 3e0e22b9206b9cee0f26d9a6bf4acd178de3e2df Mon Sep 17 00:00:00 2001 From: Dan Miller Date: Mon, 4 Nov 2019 13:02:02 -0330 Subject: [PATCH] Add translations to approve screen components --- app/_locales/en/messages.json | 50 +++++++++++++++++++ .../edit-approval-permission.component.js | 21 ++++---- .../confirm-approve-content.component.js | 23 +++++---- 3 files changed, 76 insertions(+), 18 deletions(-) diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index c6b0063e47fd..53d534a72a37 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -56,6 +56,10 @@ "acceleratingATransaction": { "message": "* Accelerating a transaction by using a higher gas price increases its chances of getting processed by the network faster, but it is not always guaranteed." }, + "accessAndSpendNotice": { + "message": "$1 may access and spend up to this max amount", + "description": "$1 is the url of the site requesting ability to spend" + }, "accessingYourCamera": { "message": "Accessing your camera..." }, @@ -113,9 +117,20 @@ "addAcquiredTokens": { "message": "Add the tokens you've acquired using MetaMask" }, + "allowOriginSpendToken": { + "message": "Allow $1 to spend your $2?", + "description": "$1 is the url of the site and $2 is the symbol of the token they are requesting to spend" + }, + "allowWithdrawAndSpend": { + "message": "Allow $1 to withdraw and spend up to the following amount:", + "description": "The url of the site that requested permission to 'withdraw and spend'" + }, "amount": { "message": "Amount" }, + "amountWithColon": { + "message": "Amount:" + }, "appDescription": { "message": "An Ethereum Wallet in your Browser", "description": "The description of the application" @@ -384,6 +399,9 @@ "customRPC": { "message": "Custom RPC" }, + "customSpendLimit": { + "message": "Custom Spend Limit" + }, "dataBackupFoundInfo": { "message": "Some of your account data was backed up during a previous installation of MetaMask. This could include your settings, contacts and tokens. Would you like to restore this data now?" }, @@ -444,6 +462,9 @@ "editContact": { "message": "Edit Contact" }, + "editPermission": { + "message": "Edit Permission" + }, "emailUs": { "message": "Email us!" }, @@ -486,6 +507,9 @@ "enterAnAlias": { "message": "Enter an alias" }, + "enterMaxSpendLimit": { + "message": "Enter Max Spend Limit" + }, "enterPassword": { "message": "Enter password" }, @@ -516,6 +540,9 @@ "faster": { "message": "Faster" }, + "feeAssociatedRequest": { + "message": "A fee is associated with this request." + }, "fiat": { "message": "Fiat", "description": "Exchange type" @@ -533,6 +560,9 @@ "fromShapeShift": { "message": "From ShapeShift" }, + "functionApprove": { + "message": "Function: Approve" + }, "functionType": { "message": "Function Type" }, @@ -953,6 +983,9 @@ "privateNetwork": { "message": "Private Network" }, + "proposedApprovalLimit": { + "message": "Proposed Approval Limit" + }, "qrCode": { "message": "Show QR Code" }, @@ -1212,6 +1245,13 @@ "speedUpTransaction": { "message": "Speed up this transaction" }, + "spendLimitPermission": { + "message": "Spend limit permission" + }, + "spendLimitRequestedBy": { + "message": "Spend limit requested by $1", + "description": "Origin of the site requesting the spend limit" + }, "switchNetworks": { "message": "Switch Networks" }, @@ -1308,6 +1348,9 @@ "to": { "message": "To" }, + "toWithColon": { + "message": "To:" + }, "toETHviaShapeShift": { "message": "$1 to ETH via ShapeShift", "description": "system will fill in deposit type in start of message" @@ -1382,6 +1425,10 @@ "message": "We had trouble loading your token balances. You can view them ", "description": "Followed by a link (here) to view token balances" }, + "trustSiteApprovePermission": { + "message": "Do you trust this site? By granting this permission, you’re allowing $1 to withdraw your $2 and automate transactions for you.", + "description": "$1 is the url requesting permission and $2 is the symbol of the currency that the request is for" + }, "tryAgain": { "message": "Try again" }, @@ -1409,6 +1456,9 @@ "unknownCameraError": { "message": "There was an error while trying to access your camera. Please try again..." }, + "unlimited": { + "message": "Unlimited" + }, "unlock": { "message": "Unlock" }, diff --git a/ui/app/components/app/modals/edit-approval-permission/edit-approval-permission.component.js b/ui/app/components/app/modals/edit-approval-permission/edit-approval-permission.component.js index 22651099f795..774280dd5036 100644 --- a/ui/app/components/app/modals/edit-approval-permission/edit-approval-permission.component.js +++ b/ui/app/components/app/modals/edit-approval-permission/edit-approval-permission.component.js @@ -14,6 +14,7 @@ export default class EditApprovalPermission extends PureComponent { tokenSymbol: PropTypes.string, tokenBalance: PropTypes.string, setCustomAmount: PropTypes.func, + origin: PropTypes.string, } static contextTypes = { @@ -26,6 +27,7 @@ export default class EditApprovalPermission extends PureComponent { } renderModalContent () { + const { t } = this.context const { hideModal, selectedIdentity, @@ -33,6 +35,7 @@ export default class EditApprovalPermission extends PureComponent { tokenSymbol, tokenBalance, customTokenAmount, + origin, } = this.props const { name, address } = selectedIdentity || {} @@ -40,7 +43,7 @@ export default class EditApprovalPermission extends PureComponent {
- Edit Permission + { t('editPermission') }
{ name }
-
Balance
+
{ t('balance') }
{`${tokenBalance} ${tokenSymbol}`} @@ -62,10 +65,10 @@ export default class EditApprovalPermission extends PureComponent {
- Spend limit permission + { t('spendLimitPermission') }
- Allow Uniswap to withdraw and spend up to the following amount: + { t('allowWithdrawAndSpend', [origin]) }
{ tokenAmount < tokenBalance - ? -'Proposed Approval Limit' - : 'Unlimited' + ? t('proposedApprovalLimit') + : t('unlimited') }
- Spend limit requested by Uniswap + { t('spendLimitRequestedBy', [origin]) }
{`${tokenAmount} ${tokenSymbol}`} @@ -115,10 +118,10 @@ export default class EditApprovalPermission extends PureComponent { 'edit-approval-permission__edit-section__option-label': this.state.selectedOption !== 'custom', 'edit-approval-permission__edit-section__option-label--selected': this.state.selectedOption === 'custom', })}> - Custom spend limit + { t('customSpendLimit') }
- Enter a max spend limit + { t('enterMaxSpendLimit') }
- A fee is associated with this request. Learn why + { t('feeAssociatedRequest') }
@@ -87,17 +89,18 @@ export default class ConfirmApproveContent extends Component { } renderPermissionContent () { + const { t } = this.context const { customTokenAmount, tokenAmount, tokenSymbol, origin, toAddress } = this.props return (
-
{origin} may access and spend up to this max amount
+
{ t('accessAndSpendNotice', [origin]) }
-
Amount:
+
{ t('amountWithColon') }
{ `${customTokenAmount || tokenAmount} ${tokenSymbol}` }
-
To:
+
{ t('toWithColon') }
{ addressSummary(toAddress) }
@@ -105,16 +108,18 @@ export default class ConfirmApproveContent extends Component { } renderDataContent () { + const { t } = this.context const { data } = this.props return (
-
Function: Approve
+
{ t('functionApprove') }
{ data }
) } render () { + const { t } = this.context const { siteImage, tokenAmount, @@ -141,19 +146,19 @@ export default class ConfirmApproveContent extends Component { />
- { `Allow ${origin} to spend your ${tokenSymbol}?` } + { t('allowOriginSpendToken', [origin, tokenSymbol]) }
- { `Do you trust this site? By granting this permission, you’re allowing ${origin} to withdraw your ${tokenSymbol} and automate transactions for you.` } + { t('trustSiteApprovePermission', [origin, tokenSymbol]) }
showEditApprovalPermissionModal({ customTokenAmount, tokenAmount, tokenSymbol, setCustomAmount, tokenBalance })} + onClick={() => showEditApprovalPermissionModal({ customTokenAmount, tokenAmount, tokenSymbol, setCustomAmount, tokenBalance, origin })} > - Edit permission + { t('editPermission') }