patch en locale messages for terminal

pull/4067/head
drafish 1 year ago committed by Aniket
parent 56ec609628
commit 36ef483edd
  1. 28
      apps/remix-ide/src/app/tabs/locales/en/terminal.json
  2. 12
      libs/remix-ui/terminal/src/lib/components/RenderCall.tsx
  3. 11
      libs/remix-ui/terminal/src/lib/components/RenderKnownTransactions.tsx
  4. 11
      libs/remix-ui/terminal/src/lib/components/RenderUnknownTransactions.tsx
  5. 32
      libs/remix-ui/terminal/src/lib/components/Table.tsx
  6. 17
      libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx

@ -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"
}

@ -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
</span>
<div className="remix_ui_terminal_buttons">
<div className="remix_ui_terminal_debug btn btn-primary btn-sm" onClick={(event) => debug(event, tx)}>
Debug
<FormattedMessage id="terminal.debug" />
</div>
</div>
<i className={`remix_ui_terminal_arrow fas ${showTableHash.includes(tx.hash) ? 'fa-angle-up' : 'fa-angle-down'}`}></i>

@ -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 {

@ -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 {

@ -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 ? (
<tr className="remix_ui_terminal_tr">
<td className="remix_ui_terminal_td" data-shared={`key_${opts.hash}`}>
status
<FormattedMessage id="terminal.status" />
</td>
<td className="remix_ui_terminal_td" data-id={`txLoggerTableStatus${opts.hash}`} data-shared={`pair_${opts.hash}`}>{`${opts.status} ${msg}`}</td>
</tr>
@ -48,7 +50,7 @@ const showTable = (opts, showTableHash) => {
{opts.hash && !opts.isCall ? (
<tr className="remix_ui_terminal_tr">
<td className="remix_ui_terminal_td" data-shared={`key_${opts.hash}`}>
transaction hash
<FormattedMessage id="terminal.transactionHash" />
</td>
<td className="remix_ui_terminal_td" data-id={`txLoggerTableHash${opts.hash}`} data-shared={`pair_${opts.hash}`}>
{opts.hash}
@ -59,7 +61,7 @@ const showTable = (opts, showTableHash) => {
{opts.blockHash ? (
<tr className="remix_ui_terminal_tr">
<td className="remix_ui_terminal_td" data-shared={`key_${opts.hash}`}>
block hash
<FormattedMessage id="terminal.blockHash" />
</td>
<td className="remix_ui_terminal_td" data-id={`txLoggerTableContractAddress${opts.hash}`} data-shared={`pair_${opts.hash}`}>
{opts.blockHash}
@ -70,7 +72,7 @@ const showTable = (opts, showTableHash) => {
{opts.blockNumber ? (
<tr className="remix_ui_terminal_tr">
<td className="remix_ui_terminal_td" data-shared={`key_${opts.hash}`}>
block number
<FormattedMessage id="terminal.blockNumber" />
</td>
<td className="remix_ui_terminal_td" data-id={`txLoggerTableContractAddress${opts.hash}`} data-shared={`pair_${opts.hash}`}>
{opts.blockNumber}
@ -81,7 +83,7 @@ const showTable = (opts, showTableHash) => {
{opts.contractAddress ? (
<tr className="remix_ui_terminal_tr">
<td className="remix_ui_terminal_td" data-shared={`key_${opts.hash}`}>
contract address
<FormattedMessage id="terminal.contractAddress" />
</td>
<td className="remix_ui_terminal_td" data-id={`txLoggerTableContractAddress${opts.hash}`} data-shared={`pair_${opts.hash}`}>
{opts.contractAddress}
@ -125,7 +127,7 @@ const showTable = (opts, showTableHash) => {
{opts.transactionCost ? (
<tr className="remix_ui_terminal_tr">
<td className="remix_ui_terminal_td" data-shared={`key_${opts.hash}`}>
transaction cost
<FormattedMessage id="terminal.transactionCost" />
</td>
<td className="remix_ui_terminal_td" data-id={`txLoggerTableTransactionCost${opts.hash}`} data-shared={`pair_${opts.hash}`}>
{opts.transactionCost} gas {callWarning}
@ -136,7 +138,7 @@ const showTable = (opts, showTableHash) => {
{opts.executionCost ? (
<tr className="remix_ui_terminal_tr">
<td className="remix_ui_terminal_td" data-shared={`key_${opts.hash}`}>
execution cost
<FormattedMessage id="terminal.executionCost" />
</td>
<td className="remix_ui_terminal_td" data-id={`txLoggerTableExecutionHash${opts.hash}`} data-shared={`pair_${opts.hash}`}>
{opts.executionCost} gas {callWarning}
@ -147,7 +149,7 @@ const showTable = (opts, showTableHash) => {
{opts.input ? (
<tr className="remix_ui_terminal_tr">
<td className="remix_ui_terminal_td" data-shared={`key_${opts.hash}`}>
input
<FormattedMessage id="terminal.input" />
</td>
<td className="remix_ui_terminal_td" data-id={`txLoggerTableHash${opts.hash}`} data-shared={`pair_${opts.hash}`}>
{shortenHexData(opts.input)}
@ -158,7 +160,7 @@ const showTable = (opts, showTableHash) => {
{opts['decoded input'] ? (
<tr className="remix_ui_terminal_tr">
<td className="remix_ui_terminal_td" data-shared={`key_${opts.hash}`}>
decoded input
<FormattedMessage id="terminal.decodedInput" />
</td>
<td className="remix_ui_terminal_td" data-id={`txLoggerTableHash${opts.hash}`} data-shared={`pair_${opts.hash}`}>
{opts['decoded input'].trim()}
@ -169,7 +171,7 @@ const showTable = (opts, showTableHash) => {
{opts['decoded output'] ? (
<tr className="remix_ui_terminal_tr">
<td className="remix_ui_terminal_td" data-shared={`key_${opts.hash}`}>
decoded output
<FormattedMessage id="terminal.decodedOutput" />
</td>
<td className="remix_ui_terminal_td" data-id={`txLoggerTableHash${opts.hash}`} data-shared={`pair_${opts.hash}`}>
{opts['decoded output']}
@ -180,7 +182,7 @@ const showTable = (opts, showTableHash) => {
{opts.logs ? (
<tr className="remix_ui_terminal_tr">
<td className="remix_ui_terminal_td" data-shared={`key_${opts.hash}`}>
logs
<FormattedMessage id="terminal.logs" />
</td>
<td className="remix_ui_terminal_td" data-id={`txLoggerTableHash${opts.hash}`} data-shared={`pair_${opts.hash}`}>
{JSON.stringify(stringified, null, '\t')}

@ -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) => {
<div style={{ flexGrow: 1 }} className="remix_ui_terminal_panel" ref={panelRef}>
<div className="remix_ui_terminal_bar d-flex">
<div className="remix_ui_terminal_menu d-flex w-100 align-items-center position-relative border-top border-dark bg-light" ref={terminalMenu} data-id="terminalToggleMenu">
<CustomTooltip placement="top" tooltipId="terminalToggle" tooltipClasses="text-nowrap" tooltipText={isOpen ? 'Hide Terminal' : 'Show Terminal'}>
<CustomTooltip
placement="top"
tooltipId="terminalToggle"
tooltipClasses="text-nowrap"
tooltipText={isOpen ? <FormattedMessage id="terminal.hideTerminal" /> : <FormattedMessage id="terminal.showTerminal" />}
>
<i
className={`mx-2 remix_ui_terminal_toggleTerminal fas ${isOpen ? 'fa-angle-double-down' : 'fa-angle-double-up'}`}
data-id="terminalToggleIcon"
@ -585,11 +590,11 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
></i>
</CustomTooltip>
<div className="mx-2 remix_ui_terminal_console" id="clearConsole" data-id="terminalClearConsole" onClick={handleClearConsole}>
<CustomTooltip placement="top" tooltipId="terminalClear" tooltipClasses="text-nowrap" tooltipText="Clear console">
<CustomTooltip placement="top" tooltipId="terminalClear" tooltipClasses="text-nowrap" tooltipText={<FormattedMessage id="terminal.clearConsole" />}>
<i className="fas fa-ban" aria-hidden="true"></i>
</CustomTooltip>
</div>
<CustomTooltip placement="top" tooltipId="terminalClear" tooltipClasses="text-nowrap" tooltipText="Pending Transactions">
<CustomTooltip placement="top" tooltipId="terminalClear" tooltipClasses="text-nowrap" tooltipText={<FormattedMessage id="terminal.pendingTransactions" />}>
<div className="mx-2">0</div>
</CustomTooltip>
<div className="h-80 mx-3 align-items-center remix_ui_terminal_listenOnNetwork custom-control custom-checkbox">
@ -789,8 +794,8 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
cancelFn={modalState.cancelFn}
handleHide={handleHideModal}
/>
{toaster && <Toaster message="no content to execute" />}
{toastProvider.show && <Toaster message={`provider for path ${toastProvider.fileName} not found`} />}
{toaster && <Toaster message={intl.formatMessage({id: 'terminal.toasterMsg1'})} />}
{toastProvider.show && <Toaster message={intl.formatMessage({id: 'terminal.toasterMsg2'}, {fileName: toastProvider.fileName})} />}
</div>
)
}

Loading…
Cancel
Save