From 71b7764ff9f93706731e805ecb35c9c545ff1774 Mon Sep 17 00:00:00 2001 From: drafish Date: Wed, 29 Jun 2022 16:46:54 +0800 Subject: [PATCH] add udapp,debugger localeMessage --- apps/remix-ide/src/app/tabs/locales/en-US.js | 29 +++++++++++++++++++ apps/remix-ide/src/app/tabs/locales/zh-CN.js | 29 +++++++++++++++++++ .../debugger-ui/src/lib/debugger-ui.tsx | 15 ++++++---- .../src/lib/tx-browser/tx-browser.tsx | 10 +++++-- .../run-tab/src/lib/components/account.tsx | 15 ++++++---- .../src/lib/components/contractDropdownUI.tsx | 22 +++++++++----- .../src/lib/components/deployButton.tsx | 7 +++-- .../src/lib/components/environment.tsx | 12 ++++++-- .../run-tab/src/lib/components/gasPrice.tsx | 3 +- .../lib/components/instanceContainerUI.tsx | 9 ++++-- .../src/lib/components/recorderCardUI.tsx | 12 ++++++-- .../run-tab/src/lib/components/value.tsx | 3 +- 12 files changed, 131 insertions(+), 35 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/locales/en-US.js b/apps/remix-ide/src/app/tabs/locales/en-US.js index 0f99659069..4d6fc7dd28 100644 --- a/apps/remix-ide/src/app/tabs/locales/en-US.js +++ b/apps/remix-ide/src/app/tabs/locales/en-US.js @@ -70,8 +70,37 @@ export default { 'terminal.welcomeText10': 'Type the library name to see available commands', 'debugger.displayName': 'Debugger', + 'debugger.debuggerConfiguration': 'Debugger Configuration', + 'debugger.stopDebugging': 'Stop debugging', + 'debugger.startDebugging': 'Start debugging', + 'debugger.placeholder': 'Transaction hash, should start with 0x', + 'debugger.introduction': `When Debugging with a transaction hash, + if the contract is verified, Remix will try to fetch the source code from Sourcify or Etherscan. Put in your Etherscan API key in the Remix settings. + For supported networks, please see`, 'udapp.displayName': 'Deploy & run transactions', + 'udapp.gasLimit': 'Gas limit', + 'udapp.account': 'Account', + 'udapp.value': 'Value', + 'udapp.contract': 'Contract', + 'udapp.signAMessage': 'Sign a message', + 'udapp.enterAMessageToSign': 'Enter a message to sign', + 'udapp.hash': 'hash', + 'udapp.signature': 'signature', + 'udapp.signedMessage': 'Signed Message', + 'udapp.environment': 'Environment', + 'udapp.setupEnvironmentDocs': 'check out docs to setup Environment', + 'udapp.deploy': 'Deploy', + 'udapp.publishTo': 'Publish to', + 'udapp.or': 'or', + 'udapp.atAddress': 'At Address', + 'udapp.noCompiledContracts': 'No compiled contracts', + 'udapp.loadContractFromAddress': 'Load contract from Address', + 'udapp.deployedContracts': 'Deployed Contracts', + 'udapp.deployAndRunClearInstances': 'Clear instances list and reset recorder', + 'udapp.deployAndRunNoInstanceText': 'Currently you have no contract instances to interact with.', + 'udapp.transactionsRecorded': 'Transactions recorded', + 'udapp.transactionsRecordedText': 'All transactions (deployed contracts and function executions) can be saved and replayed inanother environment. e.g Transactions created in Javascript VM can be replayed in the Injected Web3.', 'search.displayName': 'Search in files', 'search.replace': 'Replace', diff --git a/apps/remix-ide/src/app/tabs/locales/zh-CN.js b/apps/remix-ide/src/app/tabs/locales/zh-CN.js index 58a0f515da..67065403f4 100644 --- a/apps/remix-ide/src/app/tabs/locales/zh-CN.js +++ b/apps/remix-ide/src/app/tabs/locales/zh-CN.js @@ -70,8 +70,37 @@ export default { 'terminal.welcomeText10': '输入库名查看可用的指令', 'debugger.displayName': '调试器', + 'debugger.debuggerConfiguration': '调试器配置', + 'debugger.stopDebugging': '停止调试', + 'debugger.startDebugging': '开始调试', + 'debugger.placeholder': '交易哈希, 应该以 0x 开头', + 'debugger.introduction': `当使用交易哈希调试时, + 如果该合约已被验证, Remix 会试图从 Sourcify 或 Etherscan 获取源码. 在 Remix 中设置您的 Etherscan API key. + 有关受支持的网络,请参阅`, 'udapp.displayName': '部署 & 发交易', + 'udapp.gasLimit': 'Gas 上限', + 'udapp.account': '账户', + 'udapp.value': '以太币数量', + 'udapp.contract': '合约', + 'udapp.signAMessage': '给一个消息签名', + 'udapp.enterAMessageToSign': '输入一个需要签名的消息', + 'udapp.hash': '哈希', + 'udapp.signature': '签名', + 'udapp.signedMessage': '已签名的消息', + 'udapp.environment': '环境', + 'udapp.setupEnvironmentDocs': '查看环境设置文档', + 'udapp.deploy': '部署', + 'udapp.publishTo': '发布到', + 'udapp.or': '或', + 'udapp.atAddress': '合约地址', + 'udapp.noCompiledContracts': '没有已编译的合约', + 'udapp.loadContractFromAddress': '加载此地址的合约', + 'udapp.deployedContracts': '已部署的合约', + 'udapp.deployAndRunClearInstances': '清空合约实例并重置交易记录', + 'udapp.deployAndRunNoInstanceText': '当前您没有可交互的合约实例.', + 'udapp.transactionsRecorded': '已记录交易', + 'udapp.transactionsRecordedText': '可以记录一个环境中的所有交易 (包括合约部署和函数调用)并在另一个环境中重放。 例如在Javascript虚拟机环境中记录的交易可以在注入的Web3环境中重放。', 'search.displayName': '全文搜索', 'search.replace': '替换', diff --git a/libs/remix-ui/debugger-ui/src/lib/debugger-ui.tsx b/libs/remix-ui/debugger-ui/src/lib/debugger-ui.tsx index 25dd08705b..9d30bfdc3e 100644 --- a/libs/remix-ui/debugger-ui/src/lib/debugger-ui.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/debugger-ui.tsx @@ -1,4 +1,5 @@ import React, { useState, useEffect } from 'react' // eslint-disable-line +import { FormattedMessage } from 'react-intl' import TxBrowser from './tx-browser/tx-browser' // eslint-disable-line import StepManager from './step-manager/step-manager' // eslint-disable-line import VmDebugger from './vm-debugger/vm-debugger' // eslint-disable-line @@ -100,7 +101,7 @@ export const DebuggerUI = (props: DebuggerUIProps) => { }) debuggerInstance.event.register('newSourceLocation', async (lineColumnPos, rawLocation, generatedSources, address) => { - if (!lineColumnPos) { + if (!lineColumnPos) { await debuggerModule.discardHighlight() setState(prevState => { return { ...prevState, sourceLocationStatus: 'Source location not available, neither in Sourcify nor in Etherscan. Please make sure the Etherscan api key is provided in the settings.' } @@ -324,7 +325,9 @@ export const DebuggerUI = (props: DebuggerUIProps) => {
-

Debugger Configuration

+

+ +

{ setState(prevState => { @@ -346,13 +349,13 @@ export const DebuggerUI = (props: DebuggerUIProps) => {
{ state.debugging && state.sourceLocationStatus &&
{state.sourceLocationStatus}
} - { !state.debugging && + { !state.debugging &&
- When Debugging with a transaction hash, - if the contract is verified, Remix will try to fetch the source code from Sourcify or Etherscan. Put in your Etherscan API key in the Remix settings. - For supported networks, please see: https://sourcify.dev & https://etherscan.io/contractsVerified + : https://sourcify.dev & https://etherscan.io/contractsVerified
} { state.debugging && } diff --git a/libs/remix-ui/debugger-ui/src/lib/tx-browser/tx-browser.tsx b/libs/remix-ui/debugger-ui/src/lib/tx-browser/tx-browser.tsx index 00b241c38a..8baa4b8a1a 100644 --- a/libs/remix-ui/debugger-ui/src/lib/tx-browser/tx-browser.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/tx-browser/tx-browser.tsx @@ -1,4 +1,5 @@ import React, { useState, useEffect, useRef } from 'react' //eslint-disable-line +import { useIntl } from 'react-intl' import './tx-browser.css' export const TxBrowser = ({ requestDebug, updateTxNumberFlag, unloadRequested, transactionNumber, debugging }) => { @@ -7,6 +8,9 @@ export const TxBrowser = ({ requestDebug, updateTxNumberFlag, unloadRequested, t }) const inputValue = useRef(null) + + const intl = useIntl() + useEffect(() => { setState(prevState => { return { @@ -58,7 +62,7 @@ export const TxBrowser = ({ requestDebug, updateTxNumberFlag, unloadRequested, t type='text' onChange={({ target: { value } }) => txInputChanged(value)} onInput={txInputOnInput} - placeholder={'Transaction hash, should start with 0x'} + placeholder={intl.formatMessage({id: 'debugger.placeholder', defaultMessage: 'Transaction hash, should start with 0x'})} data-id='debuggerTransactionInput' disabled={debugging} /> @@ -67,12 +71,12 @@ export const TxBrowser = ({ requestDebug, updateTxNumberFlag, unloadRequested, t
diff --git a/libs/remix-ui/run-tab/src/lib/components/account.tsx b/libs/remix-ui/run-tab/src/lib/components/account.tsx index f8a74a1a34..d0fac49990 100644 --- a/libs/remix-ui/run-tab/src/lib/components/account.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/account.tsx @@ -1,5 +1,6 @@ // eslint-disable-next-line no-use-before-define import React, { useEffect, useState, useRef } from 'react' +import { FormattedMessage, useIntl } from 'react-intl' import { CopyToClipboard } from '@remix-ui/clipboard' import { AccountProps } from '../types' import { PassphrasePrompt } from './passphrase' @@ -13,6 +14,8 @@ export function AccountUI (props: AccountProps) { }) const messageRef = useRef('') + const intl = useIntl() + useEffect(() => { if (!selectedAccount && accounts.length > 0) props.setAccount(accounts[0]) }, [accounts, selectedAccount]) @@ -78,7 +81,7 @@ export function AccountUI (props: AccountProps) { message='Enter your passphrase for this account to sign the message' setPassphrase={props.setPassphrase} />, 'OK', () => { - props.modal('Sign a message', signMessagePrompt(), 'OK', () => { + props.modal(intl.formatMessage({id: 'udapp.signAMessage', defaultMessage: 'Sign a message'}), signMessagePrompt(), 'OK', () => { props.signMessageWithAddress(selectedAccount, messageRef.current, signedMessagePrompt, props.passphrase) props.setPassphrase('') }, 'Cancel', null) @@ -87,7 +90,7 @@ export function AccountUI (props: AccountProps) { }) } - props.modal('Sign a message', signMessagePrompt(), 'OK', () => { + props.modal(intl.formatMessage({id: 'udapp.signAMessage', defaultMessage: 'Sign a message'}), signMessagePrompt(), 'OK', () => { props.signMessageWithAddress(selectedAccount, messageRef.current, signedMessagePrompt) }, 'Cancel', null) } @@ -119,7 +122,7 @@ export function AccountUI (props: AccountProps) { const signMessagePrompt = () => { return ( -
Enter a message to sign +