diff --git a/apps/remix-ide/src/app/tabs/locales/en/terminal.json b/apps/remix-ide/src/app/tabs/locales/en/terminal.json index a175436686..64a2ac2cab 100644 --- a/apps/remix-ide/src/app/tabs/locales/en/terminal.json +++ b/apps/remix-ide/src/app/tabs/locales/en/terminal.json @@ -13,5 +13,31 @@ "terminal.welcomeText7": "Select a Javascript file in the file explorer and then run `remix.execute()` or `remix.exeCurrent()` in the command line interface", "terminal.welcomeText8": "Right click on a JavaScript file in the file explorer and then click `Run`", "terminal.welcomeText9": "The following libraries are accessible", - "terminal.welcomeText10": "Type the library name to see available commands" + "terminal.welcomeText10": "Type the library name to see available commands", + "terminal.text1": "This type of command has been deprecated and is not functionning anymore. Please run remix.help() to list available commands.", + "terminal.hideTerminal": "Hide Terminal", + "terminal.showTerminal": "Show Terminal", + "terminal.clearConsole": "Clear console", + "terminal.pendingTransactions": "Pending Transactions", + "terminal.toasterMsg1": "no content to execute", + "terminal.toasterMsg2": "provider for path {fileName} not found", + "terminal.vmMode": "VM mode", + "terminal.vmModeMsg": "Cannot debug this call. Debugging calls is only possible in Remix VM mode.", + "terminal.ok": "Ok", + "terminal.cancel": "Cancel", + "terminal.callWarning": "(Cost only applies when called by a contract)", + "terminal.msg1": "Transaction mined but execution failed", + "terminal.msg2": "Transaction mined and execution succeed", + "terminal.msg3": "Status not available at the moment", + "terminal.status": "status", + "terminal.transactionHash": "transaction hash", + "terminal.blockHash": "block hash", + "terminal.blockNumber": "block number", + "terminal.contractAddress": "contract address", + "terminal.transactionCost": "transaction cost", + "terminal.executionCost": "execution cost", + "terminal.input": "input", + "terminal.decodedInput": "decoded input", + "terminal.decodedOutput": "decoded output", + "terminal.logs": "logs" } diff --git a/libs/remix-ui/terminal/src/lib/components/RenderCall.tsx b/libs/remix-ui/terminal/src/lib/components/RenderCall.tsx index 989e340244..f715a9e076 100644 --- a/libs/remix-ui/terminal/src/lib/components/RenderCall.tsx +++ b/libs/remix-ui/terminal/src/lib/components/RenderCall.tsx @@ -1,4 +1,5 @@ import React from 'react' // eslint-disable-line +import {FormattedMessage, useIntl} from 'react-intl' import {shortenHexData} from '@remix-ui/helper' import CheckTxStatus from './ChechTxStatus' // eslint-disable-line import showTable from './Table' @@ -7,6 +8,7 @@ import {execution} from '@remix-project/remix-lib' const typeConversion = execution.typeConversion const RenderCall = ({tx, resolvedData, logs, index, plugin, showTableHash, txDetails, modal}) => { + const intl = useIntl() const to = resolvedData.contractName + '.' + resolvedData.fn const from = tx.from ? tx.from : ' - ' const input = tx.input ? shortenHexData(tx.input) : '' @@ -16,12 +18,12 @@ const RenderCall = ({tx, resolvedData, logs, index, plugin, showTableHash, txDet event.stopPropagation() if (tx.isCall && !tx.envMode.startsWith('vm')) { modal( - 'VM mode', - 'Cannot debug this call. Debugging calls is only possible in Remix VM mode.', - 'Ok', + intl.formatMessage({id: 'terminal.vmMode'}), + intl.formatMessage({id: 'terminal.vmModeMsg'}), + intl.formatMessage({id: 'terminal.ok'}), false, () => {}, - 'Cancel', + intl.formatMessage({id: 'terminal.cancel'}), () => {} ) } else { @@ -47,7 +49,7 @@ const RenderCall = ({tx, resolvedData, logs, index, plugin, showTableHash, txDet
debug(event, tx)}> - Debug +
diff --git a/libs/remix-ui/terminal/src/lib/components/RenderKnownTransactions.tsx b/libs/remix-ui/terminal/src/lib/components/RenderKnownTransactions.tsx index 41dfd78211..01dd02d445 100644 --- a/libs/remix-ui/terminal/src/lib/components/RenderKnownTransactions.tsx +++ b/libs/remix-ui/terminal/src/lib/components/RenderKnownTransactions.tsx @@ -1,5 +1,5 @@ import React from 'react' // eslint-disable-line -import {FormattedMessage} from 'react-intl' +import {FormattedMessage, useIntl} from 'react-intl' import CheckTxStatus from './ChechTxStatus' // eslint-disable-line import Context from './Context' // eslint-disable-line import showTable from './Table' @@ -7,16 +7,17 @@ import {execution} from '@remix-project/remix-lib' const typeConversion = execution.typeConversion const RenderKnownTransactions = ({tx, receipt, resolvedData, logs, index, plugin, showTableHash, txDetails, modal, provider}) => { + const intl = useIntl() const debug = (event, tx) => { event.stopPropagation() if (tx.isCall && !tx.envMode.startsWith('vm')) { modal( - 'VM mode', - 'Cannot debug this call. Debugging calls is only possible in Remix VM mode.', - 'Ok', + intl.formatMessage({id: 'terminal.vmMode'}), + intl.formatMessage({id: 'terminal.vmModeMsg'}), + intl.formatMessage({id: 'terminal.ok'}), false, () => {}, - 'Cancel', + intl.formatMessage({id: 'terminal.cancel'}), () => {} ) } else { diff --git a/libs/remix-ui/terminal/src/lib/components/RenderUnknownTransactions.tsx b/libs/remix-ui/terminal/src/lib/components/RenderUnknownTransactions.tsx index d226e252b8..1599178f55 100644 --- a/libs/remix-ui/terminal/src/lib/components/RenderUnknownTransactions.tsx +++ b/libs/remix-ui/terminal/src/lib/components/RenderUnknownTransactions.tsx @@ -1,20 +1,21 @@ import React, {useState} from 'react' // eslint-disable-line -import {FormattedMessage} from 'react-intl' +import {FormattedMessage, useIntl} from 'react-intl' import CheckTxStatus from './ChechTxStatus' // eslint-disable-line import Context from './Context' // eslint-disable-line import showTable from './Table' const RenderUnKnownTransactions = ({tx, receipt, index, plugin, showTableHash, txDetails, modal, provider}) => { + const intl = useIntl() const debug = (event, tx) => { event.stopPropagation() if (tx.isCall && !tx.envMode.startsWith('vm')) { modal( - 'VM mode', - 'Cannot debug this call. Debugging calls is only possible in Remix VM mode.', - 'Ok', + intl.formatMessage({id: 'terminal.vmMode'}), + intl.formatMessage({id: 'terminal.vmModeMsg'}), + intl.formatMessage({id: 'terminal.ok'}), false, () => {}, - 'Cancel', + intl.formatMessage({id: 'terminal.cancel'}), () => {} ) } else { diff --git a/libs/remix-ui/terminal/src/lib/components/Table.tsx b/libs/remix-ui/terminal/src/lib/components/Table.tsx index 540901f586..35dd5d47ea 100644 --- a/libs/remix-ui/terminal/src/lib/components/Table.tsx +++ b/libs/remix-ui/terminal/src/lib/components/Table.tsx @@ -1,10 +1,12 @@ import React from 'react' // eslint-disable-line +import {FormattedMessage, useIntl} from 'react-intl' import {CopyToClipboard} from '@remix-ui/clipboard' // eslint-disable-line import {shortenHexData} from '@remix-ui/helper' import {execution} from '@remix-project/remix-lib' const typeConversion = execution.typeConversion const showTable = (opts, showTableHash) => { + const intl = useIntl() let msg = '' let toHash const data = opts.data // opts.data = data.tx @@ -15,17 +17,17 @@ const showTable = (opts, showTableHash) => { } let callWarning = '' if (opts.isCall) { - callWarning = '(Cost only applies when called by a contract)' + callWarning = intl.formatMessage({id: 'terminal.callWarning'}) } if (!opts.isCall) { if (opts.status !== undefined && opts.status !== null) { if (opts.status === 0 || opts.status === '0x0' || opts.status === false) { - msg = 'Transaction mined but execution failed' + msg = intl.formatMessage({id: 'terminal.msg1'}) } else if (opts.status === 1 || opts.status === '0x1' || opts.status === true) { - msg = 'Transaction mined and execution succeed' + msg = intl.formatMessage({id: 'terminal.msg2'}) } } else { - msg = 'Status not available at the moment' + msg = intl.formatMessage({id: 'terminal.msg3'}) } } @@ -40,7 +42,7 @@ const showTable = (opts, showTableHash) => { {opts.status !== undefined ? ( - status + {`${opts.status} ${msg}`} @@ -48,7 +50,7 @@ const showTable = (opts, showTableHash) => { {opts.hash && !opts.isCall ? ( - transaction hash + {opts.hash} @@ -59,7 +61,7 @@ const showTable = (opts, showTableHash) => { {opts.blockHash ? ( - block hash + {opts.blockHash} @@ -70,7 +72,7 @@ const showTable = (opts, showTableHash) => { {opts.blockNumber ? ( - block number + {opts.blockNumber} @@ -81,7 +83,7 @@ const showTable = (opts, showTableHash) => { {opts.contractAddress ? ( - contract address + {opts.contractAddress} @@ -125,7 +127,7 @@ const showTable = (opts, showTableHash) => { {opts.transactionCost ? ( - transaction cost + {opts.transactionCost} gas {callWarning} @@ -136,7 +138,7 @@ const showTable = (opts, showTableHash) => { {opts.executionCost ? ( - execution cost + {opts.executionCost} gas {callWarning} @@ -147,7 +149,7 @@ const showTable = (opts, showTableHash) => { {opts.input ? ( - input + {shortenHexData(opts.input)} @@ -158,7 +160,7 @@ const showTable = (opts, showTableHash) => { {opts['decoded input'] ? ( - decoded input + {opts['decoded input'].trim()} @@ -169,7 +171,7 @@ const showTable = (opts, showTableHash) => { {opts['decoded output'] ? ( - decoded output + {opts['decoded output']} @@ -180,7 +182,7 @@ const showTable = (opts, showTableHash) => { {opts.logs ? ( - logs + {JSON.stringify(stringified, null, '\t')} diff --git a/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx b/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx index 67a439fd29..fe0245f766 100644 --- a/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx +++ b/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx @@ -199,7 +199,7 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { const _shell = async (script, scopedCommands, done) => { // default shell if (script.indexOf('remix:') === 0) { - return done(null, 'This type of command has been deprecated and is not functionning anymore. Please run remix.help() to list available commands.') + return done(null, intl.formatMessage({id: 'terminal.text1'})) } if (script.indexOf('remix.') === 0) { // we keep the old feature. This will basically only be called when the command is querying the "remix" object. @@ -577,7 +577,12 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
- + : } + > { >
- + }>
- + }>
0
@@ -789,8 +794,8 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { cancelFn={modalState.cancelFn} handleHide={handleHideModal} /> - {toaster && } - {toastProvider.show && } + {toaster && } + {toastProvider.show && }
) }