diff --git a/apps/remix-ide/src/app/files/fileManager.ts b/apps/remix-ide/src/app/files/fileManager.ts index cd9a030476..19cb956d34 100644 --- a/apps/remix-ide/src/app/files/fileManager.ts +++ b/apps/remix-ide/src/app/files/fileManager.ts @@ -1,4 +1,5 @@ 'use strict' +import { saveAs } from 'file-saver' import { Plugin } from '@remixproject/engine' import * as packageJson from '../../../../../package.json' import Registry from '../state/registry' @@ -343,6 +344,17 @@ class FileManager extends Plugin { } } + async download(path) { + try { + const fileName = helper.extractNameFromKey(path) + path = this.normalize(path) + const content: any = await this.readFile(path) + saveAs(new Blob([content]), fileName) + } catch (e) { + throw new Error(e) + } + } + /** * Create a directory * @param {string} path path of the new directory diff --git a/apps/remix-ide/src/app/plugins/permission-handler-plugin.tsx b/apps/remix-ide/src/app/plugins/permission-handler-plugin.tsx index 877d1ac4af..955baed702 100644 --- a/apps/remix-ide/src/app/plugins/permission-handler-plugin.tsx +++ b/apps/remix-ide/src/app/plugins/permission-handler-plugin.tsx @@ -1,4 +1,5 @@ import React from 'react' // eslint-disable-line +import { FormattedMessage } from 'react-intl' import { Plugin } from '@remixproject/engine' import { AppModal } from '@remix-ui/app' import { PermissionHandlerDialog, PermissionHandlerValue } from '@remix-ui/permission-handler' @@ -103,10 +104,10 @@ export class PermissionHandlerPlugin extends Plugin { } const modal: AppModal = { id: 'PermissionHandler', - title: `Permission needed for ${to.displayName || to.name}`, + title: , message: , - okLabel: 'Accept', - cancelLabel: 'Decline' + okLabel: , + cancelLabel: } const result = await this.call('notification', 'modal', modal) diff --git a/apps/remix-ide/src/app/tabs/locales/en/debugger.json b/apps/remix-ide/src/app/tabs/locales/en/debugger.json index d6516ef888..2a7d40f1da 100644 --- a/apps/remix-ide/src/app/tabs/locales/en/debugger.json +++ b/apps/remix-ide/src/app/tabs/locales/en/debugger.json @@ -4,5 +4,8 @@ "debugger.stopDebugging": "Stop debugging", "debugger.startDebugging": "Start debugging", "debugger.placeholder": "Transaction hash, should start with 0x", + "debugger.debugLocaNodeLabel": "Force using local node", + "debugger.useGeneratedSources": "Use generated sources", + "debugger.debugWithGeneratedSources": "Debug with generated sources", "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" } diff --git a/apps/remix-ide/src/app/tabs/locales/en/filePanel.json b/apps/remix-ide/src/app/tabs/locales/en/filePanel.json index 4c6393f41c..a063529231 100644 --- a/apps/remix-ide/src/app/tabs/locales/en/filePanel.json +++ b/apps/remix-ide/src/app/tabs/locales/en/filePanel.json @@ -14,7 +14,9 @@ "filePanel.workspace.download": "Download Workspace", "filePanel.workspace.restore": "Restore Workspace Backup", "filePanel.workspace.clone": "Clone Git Repository", + "filePanel.workspace.cloneMessage": "Please provide a valid git repository url.", "filePanel.workspace.enterGitUrl": "Enter git repository url", + "filePanel.workspace.switch": "Switch To Workspace", "filePanel.workspace.solghaction": "Adds a preset yml file to run solidity unit tests on github actions CI.", "filePanel.solghaction": "Solidity Test Workflow", "filePanel.workspace.tssoltestghaction": "Adds a preset yml file to run mocha and chai tests for solidity on github actions CI", @@ -38,5 +40,17 @@ "filePanel.createNewFolder": "Create New Folder", "filePanel.publishToGist": "Publish all the current workspace files to a github gist", "filePanel.uploadFile": "Load a local file into current workspace", - "filePanel.updateGist": "Update the current [gist] explorer" + "filePanel.updateGist": "Update the current [gist] explorer", + "filePanel.viewAllBranches": "View all branches", + "filePanel.createBranch": "Create branch", + "filePanel.switchBranches": "Switch branches", + "filePanel.checkoutGitBranch": "Checkout Git Branch", + "filePanel.findOrCreateABranch": "Find or create a branch.", + "filePanel.initGitRepositoryLabel": "Initialize workspace as a new git repository", + "filePanel.initGitRepositoryWarning": "Please add username and email to Remix GitHub Settings to use git features.", + "filePanel.workspaceName": "Workspace name", + "filePanel.customizeTemplate": "Customize template", + "filePanel.features": "Features", + "filePanel.upgradeability": "Upgradeability", + "filePanel.ok": "OK" } diff --git a/apps/remix-ide/src/app/tabs/locales/en/index.js b/apps/remix-ide/src/app/tabs/locales/en/index.js index 3cf383bdba..a5b807a902 100644 --- a/apps/remix-ide/src/app/tabs/locales/en/index.js +++ b/apps/remix-ide/src/app/tabs/locales/en/index.js @@ -8,6 +8,8 @@ import settingsJson from './settings.json'; import solidityJson from './solidity.json'; import terminalJson from './terminal.json'; import udappJson from './udapp.json'; +import solidityUnitTestingJson from './solidityUnitTesting.json'; +import permissionHandlerJson from './permissionHandler.json'; export default { ...debuggerJson, @@ -20,4 +22,6 @@ export default { ...solidityJson, ...terminalJson, ...udappJson, + ...solidityUnitTestingJson, + ...permissionHandlerJson, } diff --git a/apps/remix-ide/src/app/tabs/locales/en/permissionHandler.json b/apps/remix-ide/src/app/tabs/locales/en/permissionHandler.json new file mode 100644 index 0000000000..70a0e690f9 --- /dev/null +++ b/apps/remix-ide/src/app/tabs/locales/en/permissionHandler.json @@ -0,0 +1,13 @@ +{ + "permissionHandler.allPermissionsReset": "All permisssions have been reset.", + "permissionHandler.rememberText": "has changed and", + "permissionHandler.permissionHandlerMessage": "\"{from}\" {rememberText} would like to access to \"{method}\" of \"{to}\"`", + "permissionHandler.description": "Description", + "permissionHandler.noDescriptionProvided": "No description Provided", + "permissionHandler.makeSureYouTrustThisPlugin": "Make sure you trust this plugin before processing this call.", + "permissionHandler.rememberThisChoice": "Remember this choice", + "permissionHandler.resetAllPermissions": "Reset all Permissions", + "permissionHandler.permissionNeededFor": "Permission needed for {to}", + "permissionHandler.accept": "Accept", + "permissionHandler.decline": "Decline" +} diff --git a/apps/remix-ide/src/app/tabs/locales/en/solidityUnitTesting.json b/apps/remix-ide/src/app/tabs/locales/en/solidityUnitTesting.json new file mode 100644 index 0000000000..f1080804b6 --- /dev/null +++ b/apps/remix-ide/src/app/tabs/locales/en/solidityUnitTesting.json @@ -0,0 +1,35 @@ +{ + "solidityUnitTesting.displayName": "Solidity unit testing", + "solidityUnitTesting.testDirectory": "Test directory", + "solidityUnitTesting.testYourSmartContract": "Test your smart contract in Solidity.", + "solidityUnitTesting.selectDirectory": "Select directory to load and generate test files.", + "solidityUnitTesting.uiPathInputTooltip": "Press 'Enter' to change the path for test files.", + "solidityUnitTesting.uiPathInputButtonTooltip": "Create a test folder", + "solidityUnitTesting.create": "Create", + "solidityUnitTesting.generateTestsButtonTooltip": "Generate a sample test file", + "solidityUnitTesting.generate": "Generate", + "solidityUnitTesting.generateTestsLinkTooltip": "Check out documentation.", + "solidityUnitTesting.howToUse": "How to use...", + "solidityUnitTesting.runButtonTitle1": "Run tests", + "solidityUnitTesting.runButtonTitle2": "Please select Solidity compiler version greater than 0.4.12.", + "solidityUnitTesting.runButtonTitle3": "No solidity file selected", + "solidityUnitTesting.runButtonTitle4": "The \"Solidity Plugin\" should be activated", + "solidityUnitTesting.runButtonTitle5": "No test file selected", + "solidityUnitTesting.stopButtonLabel1": "Stop", + "solidityUnitTesting.stopButtonLabel2": "Stopping", + "solidityUnitTesting.run": "Run", + "solidityUnitTesting.runTestsTabStopActionTooltip": "Stop running tests", + "solidityUnitTesting.selectAll": "Select all", + "solidityUnitTesting.testTabTestsExecutionStopped": "The test execution has been stopped", + "solidityUnitTesting.testTabTestsExecutionStoppedError": "The test execution has been stopped because of error(s) in your test file", + "solidityUnitTesting.progress": "Progress: {readyTestsNumber} finished (of {runningTestsNumber})", + "solidityUnitTesting.resultFor": "Result for", + "solidityUnitTesting.passed": "Passed", + "solidityUnitTesting.failed": "Failed", + "solidityUnitTesting.timeTaken": "Time Taken", + "solidityUnitTesting.errorMessage": "Error Message", + "solidityUnitTesting.assertion": "Assertion", + "solidityUnitTesting.expectedValueShouldBe": "Expected value should be", + "solidityUnitTesting.receivedValue": "Received value", + "solidityUnitTesting.skippingTheRemainingTests": "Skipping the remaining tests of the function." +} 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 9086bcc8ac..a175436686 100644 --- a/apps/remix-ide/src/app/tabs/locales/en/terminal.json +++ b/apps/remix-ide/src/app/tabs/locales/en/terminal.json @@ -1,7 +1,9 @@ { "terminal.listen": "listen on all transactions", + "terminal.listenTitle": "If checked Remix will listen on all transactions mined in the current environment and not only transactions created by you", "terminal.search": "Search with transaction hash or address", "terminal.used": "used", + "terminal.debug": "Debug", "terminal.welcomeText1": "Welcome to", "terminal.welcomeText2": "Your files are stored in", "terminal.welcomeText3": "You can use this terminal to", diff --git a/apps/remix-ide/src/app/tabs/locales/en/udapp.json b/apps/remix-ide/src/app/tabs/locales/en/udapp.json index 7ed77d716e..c2a864e32b 100644 --- a/apps/remix-ide/src/app/tabs/locales/en/udapp.json +++ b/apps/remix-ide/src/app/tabs/locales/en/udapp.json @@ -4,6 +4,9 @@ "udapp.account": "Account", "udapp.value": "Value", "udapp.contract": "Contract", + "udapp.compiledBy": "Compiled by {compilerName}", + "udapp.infoSyncCompiledContractTooltip": "Click here to import contracts compiled from an external framework.{br}This action is enabled when Remix is connected to an external{br} framework (hardhat, truffle, foundry) through remixd.", + "udapp.remixIpfsUdappTooltip": "Publishing the source code and metadata to IPFS facilitates{br} source code verification using Sourcify and will greatly foster{br} contract adoption (auditing, debugging, calling it, etc...)", "udapp.signAMessage": "Sign a message", "udapp.enterAMessageToSign": "Enter a message to sign", "udapp.hash": "hash", @@ -15,10 +18,46 @@ "udapp.publishTo": "Publish to", "udapp.or": "or", "udapp.atAddress": "At Address", + "udapp.atAddressOptionsTitle1": "address of contract", + "udapp.atAddressOptionsTitle2": "Interact with the deployed contract - requires the .abi file or {br} compiled .sol file to be selected in the editor {br}(with the same compiler configuration)", + "udapp.atAddressOptionsTitle3": "Compile a *.sol file or select a *.abi file.", + "udapp.atAddressOptionsTitle4": "To interact with a deployed contract, either{br} enter its address and compile its source *.sol file {br}(with the same compiler settings) or select its .abi file in the editor. ", + "udapp.contractOptionsTitle1": "Please compile *.sol file to deploy or access a contract", + "udapp.contractOptionsTitle2": "Select a compiled contract to deploy or to use with At Address.", + "udapp.contractOptionsTitle3": "Select and compile *.sol file to deploy or access a contract.", + "udapp.contractOptionsTitle4": "When there is a compiled .sol file, choose the {br} contract to deploy or to use with AtAddress.'", + "udapp.checkSumWarning": "It seems you are not using a checksumed address.{br}A checksummed address is an address that contains uppercase letters, as specified in {a}.{br}Checksummed addresses are meant to help prevent users from sending transactions to the wrong address.", + "udapp.isOverSizePrompt": "Contract creation initialization returns data with length of more than 24576 bytes. The deployment will likely fails. {br}More info: {a}", + "udapp.thisContractMayBeAbstract": "This contract may be abstract, it may not implement an abstract parent's methods completely or it may not invoke an inherited contract's constructor correctly.", "udapp.noCompiledContracts": "No compiled contracts", + "udapp.addressOfContract": "Address of contract", "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.transactionsRecorded": "Transactions recorded", + "udapp.transactionsCountTooltip": "The number of recorded transactions", + "udapp.transactionSaveTooltip1": "No transactions to save", + "udapp.transactionSaveTooltip2": "Save {count} transaction as scenario file", + "udapp.transactionSaveTooltip3": "Save {count} transactions as scenario file", + "udapp.infoRecorderTooltip": "Save transactions (deployed contracts and function executions) {br}and replay them in another environment e.g Transactions created {br}in Remix VM can be replayed in the Injected Provider.", + "udapp.livemodeRecorderTooltip": "If contracts are updated after recording transactions,{br} checking this box will run recorded transactions {br}with the latest copy of the compiled contracts", + "udapp.livemodeRecorderLabel": "Run transactions using the latest compilation result", + "udapp.runRecorderTooltip": "Run transaction(s) from the current scenario file", + "udapp.save": "Save", + "udapp.run": "Run", + "udapp.ok": "OK", + "udapp.alert": "Alert", + "udapp.proceed": "Proceed", + "udapp.cancel": "Cancel", + "udapp.parameters": "Parameters", + "udapp.copyParameters": "Copy encoded input parameters to clipboard", + "udapp.copyCalldata": "Copy calldata to clipboard", + "udapp.deployWithProxy": "Deploy with Proxy", + "udapp.upgradeWithProxy": "Upgrade with Proxy", + "udapp.useLastDeployedERC1967Contract": "Use last deployed ERC1967 contract", + "udapp.proxyAddressLabel": "Proxy Address", + "udapp.proxyAddressPlaceholder": "proxy address", + "udapp.proxyAddressInputTooltip": "Enter previously deployed proxy address on the selected network", + "udapp.proxyAddressTooltip": "Select this option to use the last deployed ERC1967 contract on the current network." } diff --git a/apps/remix-ide/src/app/tabs/locales/zh/debugger.json b/apps/remix-ide/src/app/tabs/locales/zh/debugger.json index e6da2eb970..4eb729b4cc 100644 --- a/apps/remix-ide/src/app/tabs/locales/zh/debugger.json +++ b/apps/remix-ide/src/app/tabs/locales/zh/debugger.json @@ -4,5 +4,8 @@ "debugger.stopDebugging": "停止调试", "debugger.startDebugging": "开始调试", "debugger.placeholder": "交易哈希, 应该以 0x 开头", + "debugger.debugLocaNodeLabel": "强制使用本地节点", + "debugger.useGeneratedSources": "使用生成的源", + "debugger.debugWithGeneratedSources": "使用生成的源进行调试", "debugger.introduction": "当使用交易哈希调试时, 如果该合约已被验证, Remix 会试图从 Sourcify 或 Etherscan 获取源码. 在 Remix 中设置您的 Etherscan API key. 有关受支持的网络,请参阅" } diff --git a/apps/remix-ide/src/app/tabs/locales/zh/filePanel.json b/apps/remix-ide/src/app/tabs/locales/zh/filePanel.json index d663e53819..a0a1e1b0c7 100644 --- a/apps/remix-ide/src/app/tabs/locales/zh/filePanel.json +++ b/apps/remix-ide/src/app/tabs/locales/zh/filePanel.json @@ -14,13 +14,15 @@ "filePanel.workspace.download": "下载工作空间", "filePanel.workspace.restore": "恢复工作空间", "filePanel.workspace.clone": "克隆 Git 仓库", + "filePanel.workspace.cloneMessage": "请提供有效的 git 仓库 url。", "filePanel.workspace.enterGitUrl": "输入 Git 仓库地址", - "filePanel.workspace.solghaction": "添加预设 yml 文件以在 github 操作 CI 上运行 solidity 单元测试。", - "filePanel.solghaction": "Solidity Test Workflow", - "filePanel.workspace.tssoltestghaction": "添加一个预设的 yml 文件以在 github 操作 CI 上运行 mocha 和 chai 测试以确保可靠性", - "filePanel.tssoltestghaction": "Mocha Chai Test Workflow", - "filePanel.workspace.slitherghaction": "添加一个预设的 yml 文件以在 github actions CI 上运行 slither 分析", - "filePanel.slitherghaction": "Slither Workflow", + "filePanel.workspace.switch": "切换工作空间", + "filePanel.workspace.solghaction": "添加预设的 yml 文件,这样就可以在 github actions CI 上运行 solidity 单元测试。", + "filePanel.solghaction": "Solidity 测试工作流", + "filePanel.workspace.tssoltestghaction": "添加一个预设的 yml 文件,这样就可以在 github actions CI 上为 solidity 运行 mocha 和 chai 测试", + "filePanel.tssoltestghaction": "Mocha Chai 测试工作流", + "filePanel.workspace.slitherghaction": "添加一个预设的 yml 文件,这样就可以在 github actions CI 上运行 slither 分析", + "filePanel.slitherghaction": "Slither 工作流", "filePanel.newFile": "新建文件", "filePanel.newFolder": "新建文件夹", "filePanel.rename": "重命名", @@ -38,5 +40,17 @@ "filePanel.createNewFolder": "新建文件夹", "filePanel.publishToGist": "将当前工作空间下所有文件发布到github gist", "filePanel.uploadFile": "加载本地文件到当前工作空间", - "filePanel.updateGist": "更新当前 [gist] 浏览" + "filePanel.updateGist": "更新当前 [gist] 浏览", + "filePanel.viewAllBranches": "查看所有分支", + "filePanel.createBranch": "创建分支", + "filePanel.switchBranches": "切换分支", + "filePanel.checkoutGitBranch": "切换 Git 分支", + "filePanel.findOrCreateABranch": "查找或创建一个分支。", + "filePanel.initGitRepositoryLabel": "初始化工作空间为一个新的 git 仓库", + "filePanel.initGitRepositoryWarning": "请将用户名和电子邮件添加到 Remix GitHub 设置以使用 git 功能。", + "filePanel.workspaceName": "工作空间名称", + "filePanel.customizeTemplate": "自定义模板", + "filePanel.features": "特点", + "filePanel.upgradeability": "可升级性", + "filePanel.ok": "确认" } diff --git a/apps/remix-ide/src/app/tabs/locales/zh/home.json b/apps/remix-ide/src/app/tabs/locales/zh/home.json index 24b08eaef4..4d148b3677 100644 --- a/apps/remix-ide/src/app/tabs/locales/zh/home.json +++ b/apps/remix-ide/src/app/tabs/locales/zh/home.json @@ -9,9 +9,10 @@ "home.featured": "精选", "home.jumpIntoWeb3": "迎接 WEB3", "home.jumpIntoWeb3Text": "Remix 项目是一个丰富的工具集,任何知识水平的用户都可以在这上面进行全周期的合约开发,并且可作为以太坊教学和实验的学习实验室。", - "home.remixYouTube": "", - "home.remixYouTubeText1": "", - "home.remixYouTubeText2": "", + "home.remixYouTube": "观看学习", + "home.remixYouTubeText1": "来自 Remix 团队的视频小贴士", + "home.remixYouTubeMore": "观看", + "home.remixYouTubeText2": "Remix 有一个不断更新的视频库,其中包含大量的使用技巧。查看并订阅以获取我们最新上传的视频。", "home.betaTesting": "BETA 测试", "home.betaTestingText1": "我们的社区支持我们", "home.betaTestingText2": "每次 Remix IDE 发布版本之前,你都可以参与 Beta 测试。现在就来帮我们测试并且尝鲜新功能吧!", @@ -21,15 +22,15 @@ "home.solhintPluginDesc": "Solhint 是一个用于检查 Solidity 代码的开源项目", "home.sourcifyPluginDesc": "Solidity 合约和元数据验证服务。", "home.unitTestPluginDesc": "在 Solidity 中为你的合约编写和运行单元测试。", - "home.dgitPluginDesc": "", + "home.dgitPluginDesc": "为你的项目添加源码控制。", "home.getStarted": "开始使用", "home.projectTemplates": "项目模板", "home.blankTemplateDesc": "创建一个空的工作空间。", "home.remixDefaultTemplateDesc": "创建一个带有样本文件的工作空间", "home.ozerc20TemplateDesc": "通过引入 OpenZeppelin 库来创建一个 ERC20 代币。", "home.ozerc721TemplateDesc": "通过引入 OpenZeppelin 库来创建一个 NFT 代币。", - "home.ozerc1155TemplateDesc": "", - "home.gnosisSafeMultisigTemplateDesc": "", + "home.ozerc1155TemplateDesc": "通过导入 OpenZeppelin 库来创建一个 ERC1155 代币。", + "home.gnosisSafeMultisigTemplateDesc": "使用此模板创建多重签名钱包。", "home.zeroxErc20TemplateDesc": "通过引入 0xProject 合约来创建一个 ERC20 代币。", "home.learn": "学习", "home.remixBasics": "Remix 基础", diff --git a/apps/remix-ide/src/app/tabs/locales/zh/index.js b/apps/remix-ide/src/app/tabs/locales/zh/index.js index fa1ac3f56e..6b77c72871 100644 --- a/apps/remix-ide/src/app/tabs/locales/zh/index.js +++ b/apps/remix-ide/src/app/tabs/locales/zh/index.js @@ -8,6 +8,8 @@ import settingsJson from './settings.json'; import solidityJson from './solidity.json'; import terminalJson from './terminal.json'; import udappJson from './udapp.json'; +import solidityUnitTestingJson from './solidityUnitTesting.json'; +import permissionHandlerJson from './permissionHandler.json'; import enJson from '../en'; // There may have some un-translated content. Always fill in the gaps with EN JSON. @@ -23,4 +25,6 @@ export default Object.assign({}, enJson, { ...solidityJson, ...terminalJson, ...udappJson, + ...solidityUnitTestingJson, + ...permissionHandlerJson, }) diff --git a/apps/remix-ide/src/app/tabs/locales/zh/permissionHandler.json b/apps/remix-ide/src/app/tabs/locales/zh/permissionHandler.json new file mode 100644 index 0000000000..316206ef48 --- /dev/null +++ b/apps/remix-ide/src/app/tabs/locales/zh/permissionHandler.json @@ -0,0 +1,13 @@ +{ + "permissionHandler.allPermissionsReset": "已重置所有权限。", + "permissionHandler.rememberText": "已变更且", + "permissionHandler.permissionHandlerMessage": "\"{from}\" {rememberText}要访问 \"{to}\" 的 \"{method}\"", + "permissionHandler.description": "描述", + "permissionHandler.noDescriptionProvided": "没有提供描述", + "permissionHandler.makeSureYouTrustThisPlugin": "在处理此调用之前,请确保您信任此插件。", + "permissionHandler.rememberThisChoice": "记住此选项", + "permissionHandler.resetAllPermissions": "重置所有权限", + "permissionHandler.permissionNeededFor": "需要 {to} 的权限", + "permissionHandler.accept": "接受", + "permissionHandler.decline": "拒绝" +} diff --git a/apps/remix-ide/src/app/tabs/locales/zh/solidityUnitTesting.json b/apps/remix-ide/src/app/tabs/locales/zh/solidityUnitTesting.json new file mode 100644 index 0000000000..e590e33e5d --- /dev/null +++ b/apps/remix-ide/src/app/tabs/locales/zh/solidityUnitTesting.json @@ -0,0 +1,35 @@ +{ + "solidityUnitTesting.displayName": "Solidity 单元测试", + "solidityUnitTesting.testDirectory": "测试目录", + "solidityUnitTesting.testYourSmartContract": "在 Solidity 中测试您的智能合约。", + "solidityUnitTesting.selectDirectory": "选择要加载和生成测试文件的目录。", + "solidityUnitTesting.uiPathInputTooltip": "按 \"Enter\" 键更改测试文件的路径。", + "solidityUnitTesting.uiPathInputButtonTooltip": "创建一个测试目录", + "solidityUnitTesting.create": "创建", + "solidityUnitTesting.generateTestsButtonTooltip": "生成示例测试文件", + "solidityUnitTesting.generate": "生成", + "solidityUnitTesting.generateTestsLinkTooltip": "查看文档。", + "solidityUnitTesting.howToUse": "如何使用...", + "solidityUnitTesting.runButtonTitle1": "运行测试", + "solidityUnitTesting.runButtonTitle2": "请选择大于 0.4.12 的 Solidity 编译器版本。", + "solidityUnitTesting.runButtonTitle3": "未选择 solidity 文件", + "solidityUnitTesting.runButtonTitle4": "应该激活 \"Solidity Plugin\"", + "solidityUnitTesting.runButtonTitle5": "未选择测试文件", + "solidityUnitTesting.stopButtonLabel1": "停止", + "solidityUnitTesting.stopButtonLabel2": "正在停止", + "solidityUnitTesting.run": "执行", + "solidityUnitTesting.runTestsTabStopActionTooltip": "停止运行测试", + "solidityUnitTesting.selectAll": "全选", + "solidityUnitTesting.testTabTestsExecutionStopped": "测试执行已停止", + "solidityUnitTesting.testTabTestsExecutionStoppedError": "由于测试文件中的错误,测试执行已停止", + "solidityUnitTesting.progress": "进度:{readyTestsNumber} 已完成(共 {runningTestsNumber})", + "solidityUnitTesting.resultFor": "测试结果", + "solidityUnitTesting.passed": "通过", + "solidityUnitTesting.failed": "失败", + "solidityUnitTesting.timeTaken": "耗时", + "solidityUnitTesting.errorMessage": "错误信息", + "solidityUnitTesting.assertion": "断言", + "solidityUnitTesting.expectedValueShouldBe": "期望值应该是", + "solidityUnitTesting.receivedValue": "实际值", + "solidityUnitTesting.skippingTheRemainingTests": "跳过该方法的其余测试。" +} diff --git a/apps/remix-ide/src/app/tabs/locales/zh/terminal.json b/apps/remix-ide/src/app/tabs/locales/zh/terminal.json index 65e3092e84..87e1b4e9a4 100644 --- a/apps/remix-ide/src/app/tabs/locales/zh/terminal.json +++ b/apps/remix-ide/src/app/tabs/locales/zh/terminal.json @@ -1,7 +1,9 @@ { "terminal.listen": "监听所有交易", + "terminal.listenTitle": "如果选中,Remix 将监听在当前环境中挖掘到的所有交易,而不仅仅是您创建的交易", "terminal.search": "按交易哈希或地址搜索", "terminal.used": "已使用", + "terminal.debug": "调试", "terminal.welcomeText1": "欢迎使用", "terminal.welcomeText2": "您的文件储存在", "terminal.welcomeText3": "您可使用此终端", diff --git a/apps/remix-ide/src/app/tabs/locales/zh/udapp.json b/apps/remix-ide/src/app/tabs/locales/zh/udapp.json index bdec6b96e0..e60a8303c3 100644 --- a/apps/remix-ide/src/app/tabs/locales/zh/udapp.json +++ b/apps/remix-ide/src/app/tabs/locales/zh/udapp.json @@ -4,6 +4,9 @@ "udapp.account": "账户", "udapp.value": "以太币数量", "udapp.contract": "合约", + "udapp.compiledBy": "由 {compilerName} 编译", + "udapp.infoSyncCompiledContractTooltip": "单击此处导入从外部框架编译的合约。{br}当 Remix 通过 remixd 连接到外部{br}框架 (hardhat、truffle、foundry) 时启用此操作。", + "udapp.remixIpfsUdappTooltip": "将源代码和元数据发布到 IPFS 有助于{br}使用 Sourcify 验证源代码,并将极大地促进{br}合约采用(审计、调试、调用等)", "udapp.signAMessage": "给一个消息签名", "udapp.enterAMessageToSign": "输入一个需要签名的消息", "udapp.hash": "哈希", @@ -15,10 +18,46 @@ "udapp.publishTo": "发布到", "udapp.or": "或", "udapp.atAddress": "At Address", + "udapp.atAddressOptionsTitle1": "合约地址", + "udapp.atAddressOptionsTitle2": "与已部署的合约交互 - 需要在编辑器中选择 .abi 文件或{br}编译的 .sol 文件{br}(具有相同的编译器配置)", + "udapp.atAddressOptionsTitle3": "编译一个 *.sol 文件或选中一个 *.abi 文件。", + "udapp.atAddressOptionsTitle4": "要与已部署的合约进行交互,{br} 输入其地址并编译其源 *.sol 文件{br}(使用相同的编译器设置)或在编辑器中选择其 .abi 文件。", + "udapp.contractOptionsTitle1": "请编译 *.sol 文件以部署或访问合约", + "udapp.contractOptionsTitle2": "选择要部署或与 At Address 一起使用的已编译合约。", + "udapp.contractOptionsTitle3": "选择并编译 *.sol 文件以部署或访问合约。", + "udapp.contractOptionsTitle4": "当有编译的 .sol 文件时,选择 {br} 合约进行部署或与 AtAddress 一起使用。", + "udapp.checkSumWarning": "您似乎没有使用 checksumed address 。{br} checksumed address 是包含大写字母的地址,如 {a} 中所指定。{br} checksumed address 旨在帮助防止用户将交易发送到错误地址。", + "udapp.isOverSizePrompt": "合约创建初始化返回长度超过24576字节的数据。部署可能会失败。 {br}更多信息:{a}", + "udapp.thisContractMayBeAbstract": "这个合约可能是抽象的,它可能没有完全实现抽象父类的方法,或者它可能没有正确调用继承合约的构造函数。", "udapp.noCompiledContracts": "没有已编译的合约", + "udapp.addressOfContract": "合约地址", "udapp.loadContractFromAddress": "加载此地址的合约", "udapp.deployedContracts": "已部署的合约", "udapp.deployAndRunClearInstances": "清空合约实例并重置交易记录", "udapp.deployAndRunNoInstanceText": "当前您没有可交互的合约实例.", - "udapp.transactionsRecorded": "已记录的交易" + "udapp.transactionsRecorded": "已记录的交易", + "udapp.transactionsCountTooltip": "已记录的交易数", + "udapp.transactionSaveTooltip1": "没有可保存的交易", + "udapp.transactionSaveTooltip2": "将 {count} 笔交易保存到一个场景文件", + "udapp.transactionSaveTooltip3": "将 {count} 笔交易保存到一个场景文件", + "udapp.infoRecorderTooltip": "保存交易 (合约部署和方法执行) {br}然后在另一个环境中回放,比如在 Remix VM {br}创建的交易可以在 Injected Provider 中回放。", + "udapp.livemodeRecorderTooltip": "如果记录交易后合约有更新,{br}选中这个复选框就会以最新的{br}合约编译结果执行已记录的交易", + "udapp.livemodeRecorderLabel": "用最新的编译结果执行交易", + "udapp.runRecorderTooltip": "从当前场景文件中执行交易", + "udapp.save": "保存", + "udapp.run": "执行", + "udapp.ok": "确认", + "udapp.alert": "警告", + "udapp.proceed": "继续", + "udapp.cancel": "取消", + "udapp.parameters": "参数", + "udapp.copyParameters": "复制已编码的输入参数到粘贴板", + "udapp.copyCalldata": "复制 calldata 到粘贴板", + "udapp.deployWithProxy": "使用代理部署", + "udapp.upgradeWithProxy": "使用代理升级", + "udapp.useLastDeployedERC1967Contract": "使用最新的已部署的 ERC1967 合约", + "udapp.proxyAddressLabel": "代理地址", + "udapp.proxyAddressPlaceholder": "代理地址", + "udapp.proxyAddressInputTooltip": "输入先前在所选网络上部署的代理地址", + "udapp.proxyAddressTooltip": "选择此选项可使用当前网络上最后部署的 ERC1967 合约。" } diff --git a/apps/remix-ide/src/blockchain/blockchain.js b/apps/remix-ide/src/blockchain/blockchain.js index 509e2d4ea3..724d11a3b6 100644 --- a/apps/remix-ide/src/blockchain/blockchain.js +++ b/apps/remix-ide/src/blockchain/blockchain.js @@ -13,7 +13,8 @@ import { execution, EventManager, helpers } from '@remix-project/remix-lib' import { etherScanLink } from './helper' import { logBuilder, cancelUpgradeMsg, cancelProxyMsg, addressToString } from "@remix-ui/helper" const { txFormat, txExecution, typeConversion, txListener: Txlistener, TxRunner, TxRunnerWeb3, txHelper } = execution -const { txResultHelper: resultToRemixTx } = helpers +const { txResultHelper } = helpers +const { resultToRemixTx } = txResultHelper const packageJson = require('../../../../package.json') const _paq = window._paq = window._paq || [] //eslint-disable-line @@ -575,8 +576,11 @@ export class Blockchain extends Plugin { async (error, result) => { if (error) return reject(error) try { - const execResult = await this.web3().eth.getExecutionResultFromSimulator(result.transactionHash) - resolve(resultToRemixTx(result, execResult)) + if (this.executionContext.isVM()) { + const execResult = await this.web3().eth.getExecutionResultFromSimulator(result.transactionHash) + resolve(resultToRemixTx(result, execResult)) + } else + resolve(resultToRemixTx(result)) } catch (e) { reject(e) } diff --git a/libs/remix-lib/src/execution/txRunner.ts b/libs/remix-lib/src/execution/txRunner.ts index e58ac62d5e..2babf14a4b 100644 --- a/libs/remix-lib/src/execution/txRunner.ts +++ b/libs/remix-lib/src/execution/txRunner.ts @@ -1,6 +1,16 @@ 'use strict' import { EventManager } from '../eventManager' +export type Transaction = { + from: string, + to: string, + value: string, + data: string, + gasLimit: number, + useCall: boolean, + timestamp?: number +} + export class TxRunner { event runAsync @@ -19,11 +29,11 @@ export class TxRunner { this.queusTxs = [] } - rawRun (args, confirmationCb, gasEstimationForceSend, promptCb, cb) { + rawRun (args: Transaction, confirmationCb, gasEstimationForceSend, promptCb, cb) { run(this, args, args.timestamp || Date.now(), confirmationCb, gasEstimationForceSend, promptCb, cb) } - execute (args, confirmationCb, gasEstimationForceSend, promptCb, callback) { + execute (args: Transaction, confirmationCb, gasEstimationForceSend, promptCb, callback) { let data = args.data if (data.slice(0, 2) !== '0x') { data = '0x' + data @@ -32,7 +42,7 @@ export class TxRunner { } } -function run (self, tx, stamp, confirmationCb, gasEstimationForceSend = null, promptCb = null, callback = null) { +function run (self, tx: Transaction, stamp, confirmationCb, gasEstimationForceSend = null, promptCb = null, callback = null) { if (!self.runAsync && Object.keys(self.pendingTxs).length) { return self.queusTxs.push({ tx, stamp, callback }) } diff --git a/libs/remix-lib/src/execution/txRunnerVM.ts b/libs/remix-lib/src/execution/txRunnerVM.ts index 3b77637108..751042a070 100644 --- a/libs/remix-lib/src/execution/txRunnerVM.ts +++ b/libs/remix-lib/src/execution/txRunnerVM.ts @@ -6,6 +6,7 @@ import { BN, bufferToHex, Address } from 'ethereumjs-util' import type { Account } from '@ethereumjs/util' import { EventManager } from '../eventManager' import { LogsManager } from './logsManager' +import type { Transaction as InternalTransaction } from './txRunner' export type VMexecutionResult = { result: RunTxResult, @@ -52,7 +53,7 @@ export class TxRunnerVM { this.nextNonceForCall = 0 } - execute (args, confirmationCb, gasEstimationForceSend, promptCb, callback: VMExecutionCallBack) { + execute (args: InternalTransaction, confirmationCb, gasEstimationForceSend, promptCb, callback: VMExecutionCallBack) { let data = args.data if (data.slice(0, 2) !== '0x') { data = '0x' + data diff --git a/libs/remix-lib/src/execution/txRunnerWeb3.ts b/libs/remix-lib/src/execution/txRunnerWeb3.ts index 4319b8be92..c07e1c65e5 100644 --- a/libs/remix-lib/src/execution/txRunnerWeb3.ts +++ b/libs/remix-lib/src/execution/txRunnerWeb3.ts @@ -1,5 +1,6 @@ 'use strict' import { EventManager } from '../eventManager' +import type { Transaction as InternalTransaction } from './txRunner' import Web3 from 'web3' export class TxRunnerWeb3 { @@ -79,7 +80,7 @@ export class TxRunnerWeb3 { } } - execute (args, confirmationCb, gasEstimationForceSend, promptCb, callback) { + execute (args: InternalTransaction, confirmationCb, gasEstimationForceSend, promptCb, callback) { let data = args.data if (data.slice(0, 2) !== '0x') { data = '0x' + data diff --git a/libs/remix-ui/app/src/lib/remix-app/interface/index.ts b/libs/remix-ui/app/src/lib/remix-app/interface/index.ts index 69db40e679..3ab21c7cc4 100644 --- a/libs/remix-ui/app/src/lib/remix-app/interface/index.ts +++ b/libs/remix-ui/app/src/lib/remix-app/interface/index.ts @@ -9,13 +9,13 @@ export interface AppModal { id: string timestamp?: number hide?: boolean - title: string + title: string | JSX.Element validationFn?: (value: string) => ValidationResult // eslint-disable-next-line no-undef message: string | JSX.Element - okLabel: string + okLabel: string | JSX.Element okFn?: (value?:any) => void - cancelLabel: string + cancelLabel: string | JSX.Element cancelFn?: () => void, modalType?: ModalTypes, defaultValue?: string 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 34a8affad8..910ec433e3 100644 --- a/libs/remix-ui/debugger-ui/src/lib/debugger-ui.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/debugger-ui.tsx @@ -41,8 +41,8 @@ export const DebuggerUI = (props: DebuggerUIProps) => { props.onReady({ globalContext: () => { return { - block: state.currentBlock, - tx: state.currentTransaction, + block: state.currentBlock, + tx: state.currentTransaction, receipt: state.currentReceipt } } @@ -375,7 +375,7 @@ export const DebuggerUI = (props: DebuggerUIProps) => { return { ...prevState, opt: { ...prevState.opt, debugWithGeneratedSources: checked } } }) }} type="checkbox" /> - + ) return ( @@ -386,7 +386,7 @@ export const DebuggerUI = (props: DebuggerUIProps) => {
} placement="top-start" > {customJSX} @@ -398,7 +398,7 @@ export const DebuggerUI = (props: DebuggerUIProps) => { return { ...prevState, opt: { ...prevState.opt, debugWithLocalNode: checked } } }) }} type="checkbox" title="Force the debugger to use the current local node" /> - +
} { state.validationError && {state.validationError} } diff --git a/libs/remix-ui/modal-dialog/src/lib/types/index.ts b/libs/remix-ui/modal-dialog/src/lib/types/index.ts index f1ec8c88d9..44300ef135 100644 --- a/libs/remix-ui/modal-dialog/src/lib/types/index.ts +++ b/libs/remix-ui/modal-dialog/src/lib/types/index.ts @@ -7,13 +7,13 @@ export type ValidationResult = { export interface ModalDialogProps { id: string timestamp?: number, - title?: string, + title?: string | JSX.Element, validation?: ValidationResult validationFn?: (value: string) => ValidationResult message?: string | JSX.Element, - okLabel?: string, + okLabel?: string | JSX.Element, okFn?: (value?:any) => void, - cancelLabel?: string, + cancelLabel?: string | JSX.Element, cancelFn?: () => void, modalClass?: string, showCancelIcon?: boolean, diff --git a/libs/remix-ui/permission-handler/src/lib/permission-dialog.tsx b/libs/remix-ui/permission-handler/src/lib/permission-dialog.tsx index 793d2ea076..cd8fd03291 100644 --- a/libs/remix-ui/permission-handler/src/lib/permission-dialog.tsx +++ b/libs/remix-ui/permission-handler/src/lib/permission-dialog.tsx @@ -1,4 +1,5 @@ import React, { ChangeEventHandler, useContext, useEffect, useRef, useState } from 'react' // eslint-disable-line +import { FormattedMessage, useIntl } from 'react-intl' import { PermissionHandlerProps } from '../interface' import './permission-dialog.css' @@ -6,6 +7,7 @@ const PermissionHandlerDialog = (props: PermissionHandlerProps) => { const { from, to, remember, method, message, sensitiveCall } = props.value const [feedback, setFeedback] = useState('') const theme = props.theme + const intl = useIntl() const switchMode = (e: any) => { props.plugin.switchMode(from, to, method, e.target.checked) @@ -16,7 +18,7 @@ const PermissionHandlerDialog = (props: PermissionHandlerProps) => { } const reset = () => { props.plugin.clear() - setFeedback('All permisssions have been reset.') + setFeedback(intl.formatMessage({ id: 'permissionHandler.allPermissionsReset' })) } const imgFrom = () => { return } @@ -32,13 +34,13 @@ const PermissionHandlerDialog = (props: PermissionHandlerProps) => { } const text = () => { - return <>"{from.displayName}" {(remember ? 'has changed and' : '')} would like to access to "{method}" of "{to.displayName}"` + return } const pluginMessage = () => { return message ?
-
Description
+

{message}

: null } @@ -48,19 +50,19 @@ const PermissionHandlerDialog = (props: PermissionHandlerProps) => {

{text()} :

{from.displayName}
-

{from.description || No description Provided}

+

{from.description || }

{to.displayName} :
-

{to.description || No description Provided}

+

{to.description || }

{pluginMessage()} - { sensitiveCall ?

Make sure you trust this plugin before processing this call.

: '' } + { sensitiveCall ?

: '' }
{ !sensitiveCall &&
{rememberSwitch()} - +
} - +
{feedback}
) diff --git a/libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx b/libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx index 7965c4ada7..e83c0baae7 100644 --- a/libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx @@ -18,12 +18,12 @@ export function ContractDropdownUI (props: ContractDropdownProps) { content: '' }) const [atAddressOptions, setAtAddressOptions] = useState<{ title: string | JSX.Element, disabled: boolean }>({ - title: 'address of contract', + title: , disabled: true }) const [loadedAddress, setLoadedAddress] = useState('') const [contractOptions, setContractOptions] = useState<{ title: string | JSX.Element, disabled: boolean }>({ - title: 'Please compile *.sol file to deploy or access a contract', + title: , disabled: true }) const [loadedContractData, setLoadedContractData] = useState(null) @@ -136,12 +136,12 @@ export function ContractDropdownUI (props: ContractDropdownProps) { if (enable) { setAtAddressOptions({ disabled: false, - title: Interact with the deployed contract - requires the .abi file or
compiled .sol file to be selected in the editor
(with the same compiler configuration)
+ title: }} /> }) } else { setAtAddressOptions({ disabled: true, - title: loadedAddress ? 'Compile a *.sol file or select a *.abi file.' : To interact with a deployed contract, either
enter its address and compile its source *.sol file
(with the same compiler settings) or select its .abi file in the editor.
+ title: loadedAddress ? : }} /> }) } } @@ -150,12 +150,12 @@ export function ContractDropdownUI (props: ContractDropdownProps) { if (enable) { setContractOptions({ disabled: false, - title: 'Select a compiled contract to deploy or to use with At Address.' + title: }) } else { setContractOptions({ disabled: true, - title: loadType === 'sol' ? 'Select and compile *.sol file to deploy or access a contract.' : When there is a compiled .sol file, choose the
contract to deploy or to use with AtAddress.'
+ title: loadType === 'sol' ? : }} /> }) } } @@ -166,20 +166,20 @@ export function ContractDropdownUI (props: ContractDropdownProps) { const createInstance = (selectedContract, args, deployMode?: DeployMode[]) => { if (selectedContract.bytecodeObject.length === 0) { - return props.modal('Alert', 'This contract may be abstract, it may not implement an abstract parent\'s methods completely or it may not invoke an inherited contract\'s constructor correctly.', 'OK', () => { }) + return props.modal(intl.formatMessage({ id: 'udapp.alert' }), intl.formatMessage({ id: 'udapp.thisContractMayBeAbstract' }), intl.formatMessage({ id: 'udapp.ok' }), () => { }) } if ((selectedContract.name !== currentContract) && (selectedContract.name === 'ERC1967Proxy')) selectedContract.name = currentContract const isProxyDeployment = (deployMode || []).find(mode => mode === 'Deploy with Proxy') const isContractUpgrade = (deployMode || []).find(mode => mode === 'Upgrade with Proxy') if (isProxyDeployment) { - props.modal('Deploy Implementation & Proxy (ERC1967)', deployWithProxyMsg(), 'Proceed', () => { + props.modal('Deploy Implementation & Proxy (ERC1967)', deployWithProxyMsg(), intl.formatMessage({ id: 'udapp.proceed' }), () => { props.createInstance(loadedContractData, props.gasEstimationPrompt, props.passphrasePrompt, props.publishToStorage, props.mainnetPrompt, isOverSizePrompt, args, deployMode) - }, 'Cancel', () => { }) + }, intl.formatMessage({ id: 'udapp.cancel' }), () => { }) } else if (isContractUpgrade) { - props.modal('Deploy Implementation & Update Proxy', upgradeWithProxyMsg(), 'Proceed', () => { + props.modal('Deploy Implementation & Update Proxy', upgradeWithProxyMsg(), intl.formatMessage({ id: 'udapp.proceed' }), () => { props.createInstance(loadedContractData, props.gasEstimationPrompt, props.passphrasePrompt, props.publishToStorage, props.mainnetPrompt, isOverSizePrompt, args, deployMode) - }, 'Cancel', () => { }) + }, intl.formatMessage({ id: 'udapp.cancel' }), () => { }) } else { props.createInstance(loadedContractData, props.gasEstimationPrompt, props.passphrasePrompt, props.publishToStorage, props.mainnetPrompt, isOverSizePrompt, args, deployMode) } @@ -237,17 +237,15 @@ export function ContractDropdownUI (props: ContractDropdownProps) { const checkSumWarning = () => { return ( - It seems you are not using a checksumed address. -
A checksummed address is an address that contains uppercase letters, as specified in EIP-55. -
Checksummed addresses are meant to help prevent users from sending transactions to the wrong address. + , a: EIP-55 }} />
) } const isOverSizePrompt = () => { return ( -
Contract creation initialization returns data with length of more than 24576 bytes. The deployment will likely fails.
- More info: eip-170 +
+ , a: eip-170 }} />
) } @@ -259,7 +257,7 @@ export function ContractDropdownUI (props: ContractDropdownProps) { -
{compilerName && compilerName !== '' && }
+
{compilerName && compilerName !== '' && }
{props.remixdActivated ? ( - Click here to import contracts compiled from an external framework.
- This action is enabled when Remix is connected to an external
framework (hardhat, truffle, foundry) through remixd. + }} /> } > - Deploy with Proxy +
@@ -497,7 +499,7 @@ export function ContractGUI (props: ContractGUIProps) { data-id="contractGUIUpgradeImplementationLabel" className="m-0 form-check-label custom-control-label udapp_checkboxAlign" > - Upgrade with Proxy +
@@ -527,7 +529,7 @@ export function ContractGUI (props: ContractGUIProps) { checked={useLastProxy} /> } tooltipId="proxyAddressTooltip" placement="auto" tooltipClasses="text-wrap" @@ -538,7 +540,7 @@ export function ContractGUI (props: ContractGUIProps) { className="m-0 form-check-label custom-control-label udapp_checkboxAlign" style={{ fontSize: 12 }} > - Use last deployed ERC1967 contract + @@ -546,10 +548,10 @@ export function ContractGUI (props: ContractGUIProps) { !useLastProxy ?
- - validateProxyAddress(proxyAddress) } /> + }> + validateProxyAddress(proxyAddress) } /> { proxyAddressError && { proxyAddressError } }
: diff --git a/libs/remix-ui/run-tab/src/lib/components/recorderCardUI.tsx b/libs/remix-ui/run-tab/src/lib/components/recorderCardUI.tsx index 63e7a77598..6ce1ac3009 100644 --- a/libs/remix-ui/run-tab/src/lib/components/recorderCardUI.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/recorderCardUI.tsx @@ -1,6 +1,6 @@ // eslint-disable-next-line no-use-before-define import React, {useRef, useState, useEffect} from 'react' -import { FormattedMessage } from 'react-intl' +import { FormattedMessage, useIntl } from 'react-intl' import { RecorderProps } from '../types' import { CustomTooltip } from '@remix-ui/helper' @@ -8,6 +8,8 @@ export function RecorderUI (props: RecorderProps) { const inputLive = useRef() const [toggleExpander, setToggleExpander] = useState(false) const [enableRunButton, setEnableRunButton] = useState(true) + const intl = useIntl() + const triggerRecordButton = () => { props.storeScenario(props.scenarioPrompt) } @@ -38,7 +40,7 @@ export function RecorderUI (props: RecorderProps) { placement={'right'} tooltipClasses="text-nowrap" tooltipId="recordedTransactionsCounttooltip" - tooltipText={'The number of recorded transactions'} + tooltipText={} >
{props.count}
@@ -46,7 +48,7 @@ export function RecorderUI (props: RecorderProps) { placement={'right'} tooltipClasses="text-wrap" tooltipId="info-recorder" - tooltipText={Save transactions (deployed contracts and function executions)
and replay them in another environment e.g Transactions created
in Remix VM can be replayed in the Injected Provider.
} + tooltipText={ }} />} >
@@ -64,9 +66,11 @@ export function RecorderUI (props: RecorderProps) { placement={'right'} tooltipClasses="text-wrap" tooltipId="tooltip-livemode-recorder" - tooltipText={If contracts are updated after recording transactions,
checking this box will run recorded transactions
with the latest copy of the compiled contracts
} + tooltipText={ }} />} > - +
@@ -75,14 +79,14 @@ export function RecorderUI (props: RecorderProps) { tooltipClasses="text-nowrap" tooltipId="remixUdappTransactionSavetooltip" tooltipText={ - props.count === 0 ? 'No transactions to save' - : props.count === 1 ? `Save ${props.count} transaction as scenario file` - : `Save ${props.count} transactions as scenario file` + props.count === 0 ? intl.formatMessage({ id: 'udapp.transactionSaveTooltip1' }) + : props.count === 1 ? intl.formatMessage({ id: 'udapp.transactionSaveTooltip2' }, { count: props.count }) + : intl.formatMessage({ id: 'udapp.transactionSaveTooltip3' }, { count: props.count }) } > @@ -90,11 +94,11 @@ export function RecorderUI (props: RecorderProps) { placement={'right'} tooltipClasses="text-nowrap" tooltipId="tooltip-run-recorder" - tooltipText="Run transaction(s) from the current scenario file" + tooltipText={} > diff --git a/libs/remix-ui/solidity-unit-testing/src/lib/solidity-unit-testing.tsx b/libs/remix-ui/solidity-unit-testing/src/lib/solidity-unit-testing.tsx index 5b114499dd..58acc7421d 100644 --- a/libs/remix-ui/solidity-unit-testing/src/lib/solidity-unit-testing.tsx +++ b/libs/remix-ui/solidity-unit-testing/src/lib/solidity-unit-testing.tsx @@ -1,4 +1,5 @@ import React, { useState, useRef, useEffect, ReactElement } from 'react' // eslint-disable-line +import { FormattedMessage, useIntl } from 'react-intl' import * as semver from 'semver' import { eachOfSeries } from 'async' // eslint-disable-line import type Web3 from 'web3' @@ -45,14 +46,16 @@ export const SolidityUnitTesting = (props: Record) => { // eslint-d const { helper, testTab, initialPath } = props const { testTabLogic } = testTab + const intl = useIntl() + const [toasterMsg, setToasterMsg] = useState('') const [disableCreateButton, setDisableCreateButton] = useState(true) const [disableGenerateButton, setDisableGenerateButton] = useState(false) const [disableStopButton, setDisableStopButton] = useState(true) const [disableRunButton, setDisableRunButton] = useState(false) - const [runButtonTitle, setRunButtonTitle] = useState('Run tests') - const [stopButtonLabel, setStopButtonLabel] = useState('Stop') + const [runButtonTitle, setRunButtonTitle] = useState(intl.formatMessage({ id: 'solidityUnitTesting.runButtonTitle1' })) + const [stopButtonLabel, setStopButtonLabel] = useState(intl.formatMessage({ id: 'solidityUnitTesting.stopButtonLabel1' })) const [checkSelectAll, setCheckSelectAll] = useState(true) const [testsOutput, setTestsOutput] = useState([]) @@ -170,7 +173,7 @@ export const SolidityUnitTesting = (props: Record) => { // eslint-d if (!semver.gt(truncateVersion(currentVersion), '0.4.12')) { setDisableRunButton(true) - setRunButtonTitle('Please select Solidity compiler version greater than 0.4.12.') + setRunButtonTitle(intl.formatMessage({ id: 'solidityUnitTesting.runButtonTitle2' })) } }) @@ -395,17 +398,17 @@ export const SolidityUnitTesting = (props: Record) => { // eslint-d ✘ {test.value} {debugBtn}
- Error Message: + : "{test.errMsg}" - Assertion: + :
- Expected value should be +
{method}
{preposition} {expected}
- Received value: + : {test.returned} - Skipping the remaining tests of the function. + ) setTestsOutput(prevCards => ([...prevCards, testFailCard2])) } @@ -457,10 +460,10 @@ export const SolidityUnitTesting = (props: Record) => { // eslint-d const testSummary = fileTestsResult['summary'] if (testSummary && testSummary.filename && !testSummary.rendered) { const summaryCard: ReactElement = (
- Result for {testSummary.filename} - Passed: {testSummary.passed} - Failed: {testSummary.failed} - Time Taken: {testSummary.timeTaken}s + {testSummary.filename} + : {testSummary.passed} + : {testSummary.failed} + : {testSummary.timeTaken}s
) setTestsOutput(prevCards => ([...prevCards, summaryCard])) fileTestsResult['summary']['rendered'] = true @@ -523,7 +526,7 @@ export const SolidityUnitTesting = (props: Record) => { // eslint-d if (_errors || hasBeenStopped.current || readyTestsNumber === runningTestsNumber) { // All tests are ready or the operation has been canceled or there was a compilation error in one of the test files. setDisableStopButton(true) - setStopButtonLabel('Stop') + setStopButtonLabel(intl.formatMessage({ id: 'solidityUnitTesting.stopButtonLabel1' })) if (selectedTests.current?.length !== 0) { setDisableRunButton(false) } @@ -598,16 +601,16 @@ export const SolidityUnitTesting = (props: Record) => { // eslint-d if (!isSolidityActive || !selectedTests.current.length) { setDisableRunButton(true) if (!currentFile || (currentFile && currentFile.split('.').pop().toLowerCase() !== 'sol')) { - setRunButtonTitle('No solidity file selected') + setRunButtonTitle(intl.formatMessage({ id: 'solidityUnitTesting.runButtonTitle3' })) } else { - setRunButtonTitle('The "Solidity Plugin" should be activated') + setRunButtonTitle(intl.formatMessage({ id: 'solidityUnitTesting.runButtonTitle4' })) } } else setDisableRunButton(false) } const stopTests = () => { hasBeenStopped.current = true - setStopButtonLabel('Stopping') + setStopButtonLabel(intl.formatMessage({ id: 'solidityUnitTesting.stopButtonLabel2' })) setDisableStopButton(true) setDisableRunButton(true) } @@ -625,12 +628,12 @@ export const SolidityUnitTesting = (props: Record) => { // eslint-d setCheckSelectAll(true) setDisableRunButton(false) if ((readyTestsNumber === runningTestsNumber || hasBeenStopped.current) && stopButtonLabel.trim() === 'Stop') { - setRunButtonTitle('Run tests') + setRunButtonTitle(intl.formatMessage({ id: 'solidityUnitTesting.runButtonTitle1' })) } } else if (!selectedTests.current.length) { setCheckSelectAll(false) setDisableRunButton(true) - setRunButtonTitle('No test file selected') + setRunButtonTitle(intl.formatMessage({ id: 'solidityUnitTesting.runButtonTitle5' })) } else setCheckSelectAll(false) } @@ -661,9 +664,9 @@ export const SolidityUnitTesting = (props: Record) => { // eslint-d
-

Test your smart contract in Solidity.

-

Select directory to load and generate test files.

- +

+

+
{ @@ -676,7 +679,7 @@ export const SolidityUnitTesting = (props: Record) => { // eslint-d placement="top-end" tooltipClasses="text-nowrap" tooltipId="uiPathInputtooltip" - tooltipText={"Press 'Enter' to change the path for test files."} + tooltipText={} > ) => { // eslint-d placement="top-end" tooltipClasses="text-nowrap" tooltipId="uiPathInputButtontooltip" - tooltipText="Create a test folder" + tooltipText={} >
@@ -714,7 +717,7 @@ export const SolidityUnitTesting = (props: Record) => { // eslint-d } placement={'bottom-start'} > } placement={'bottom-start'} > - +
@@ -749,7 +752,7 @@ export const SolidityUnitTesting = (props: Record) => { // eslint-d >
{testFiles.length ? testFiles.map((testFileObj: TestObject, index) => { const elemId = `singleTest${testFileObj.fileName}` @@ -787,9 +790,9 @@ export const SolidityUnitTesting = (props: Record) => { // eslint-d }) : "No test file available"}
- - - + + +
{testsOutput}
diff --git a/libs/remix-ui/terminal/src/lib/components/RenderKnownTransactions.tsx b/libs/remix-ui/terminal/src/lib/components/RenderKnownTransactions.tsx index 3d3b1a2d8e..acf402a100 100644 --- a/libs/remix-ui/terminal/src/lib/components/RenderKnownTransactions.tsx +++ b/libs/remix-ui/terminal/src/lib/components/RenderKnownTransactions.tsx @@ -1,5 +1,6 @@ import React from 'react' // eslint-disable-line +import { FormattedMessage } from 'react-intl' import CheckTxStatus from './ChechTxStatus' // eslint-disable-line import Context from './Context' // eslint-disable-line import showTable from './Table' @@ -31,7 +32,7 @@ const RenderKnownTransactions = ({ tx, receipt, resolvedData, logs, index, plugi data-shared='txLoggerDebugButton' data-id={`txLoggerDebugButton${tx.hash}`} onClick={(event) => debug(event, tx)} - >Debug + > diff --git a/libs/remix-ui/terminal/src/lib/components/RenderUnknownTransactions.tsx b/libs/remix-ui/terminal/src/lib/components/RenderUnknownTransactions.tsx index 9400d83b4a..923fb19557 100644 --- a/libs/remix-ui/terminal/src/lib/components/RenderUnknownTransactions.tsx +++ b/libs/remix-ui/terminal/src/lib/components/RenderUnknownTransactions.tsx @@ -1,4 +1,5 @@ import React, { useState } from 'react' // eslint-disable-line +import { FormattedMessage } from 'react-intl' import CheckTxStatus from './ChechTxStatus' // eslint-disable-line import Context from './Context' // eslint-disable-line import showTable from './Table' @@ -27,7 +28,7 @@ const RenderUnKnownTransactions = ({ tx, receipt, index, plugin, showTableHash, data-shared='txLoggerDebugButton' data-id={`txLoggerDebugButton${tx.hash}`} onClick={(event) => debug(event, tx)} - >Debug + > 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 3a4fb13882..0743efc56e 100644 --- a/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx +++ b/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx @@ -464,11 +464,11 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { id="listenNetworkCheck" onChange={listenOnNetwork} type="checkbox" - title="If checked Remix will listen on all transactions mined in the current environment and not only transactions created by you" + title={intl.formatMessage({ id: 'terminal.listenTitle' })} />