From 65e0360b5df72539be4d1a154a8ba798b31467c0 Mon Sep 17 00:00:00 2001 From: drafish Date: Wed, 14 Dec 2022 15:25:08 +0800 Subject: [PATCH] filePanel intl patch --- .../src/app/tabs/locales/en/filePanel.json | 16 ++++++- .../src/app/tabs/locales/zh/filePanel.json | 28 ++++++++--- .../workspace/src/lib/remix-ui-workspace.tsx | 48 +++++++++++-------- 3 files changed, 63 insertions(+), 29 deletions(-) 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/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/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index 6eba79f344..7776632c24 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -73,18 +73,18 @@ export function Workspace () { }, [currentWorkspace]) const renameCurrentWorkspace = () => { - global.modal(intl.formatMessage({ id: 'filePanel.workspace.rename' }), renameModalMessage(), 'OK', onFinishRenameWorkspace, '') + global.modal(intl.formatMessage({ id: 'filePanel.workspace.rename' }), renameModalMessage(), intl.formatMessage({ id: 'filePanel.ok' }), onFinishRenameWorkspace, '') } const createWorkspace = () => { - global.modal(intl.formatMessage({ id: 'filePanel.workspace.create' }), createModalMessage(), 'OK', onFinishCreateWorkspace, '') + global.modal(intl.formatMessage({ id: 'filePanel.workspace.create' }), createModalMessage(), intl.formatMessage({ id: 'filePanel.ok' }), onFinishCreateWorkspace, '') } const deleteCurrentWorkspace = () => { global.modal( intl.formatMessage({ id: 'filePanel.workspace.delete' }), intl.formatMessage({ id: 'filePanel.workspace.deleteConfirm' }), - 'OK', + intl.formatMessage({ id: 'filePanel.ok' }), onFinishDeleteWorkspace, '' ) @@ -94,7 +94,7 @@ export function Workspace () { global.modal( intl.formatMessage({ id: 'filePanel.workspace.clone' }), cloneModalMessage(), - 'OK', + intl.formatMessage({ id: 'filePanel.ok' }), handleTypingUrl, '' ) @@ -136,7 +136,7 @@ export function Workspace () { try { await global.dispatchRenameWorkspace(currentWorkspace, workspaceName) } catch (e) { - global.modal('Rename Workspace', e.message, 'OK', () => {}, '') + global.modal(intl.formatMessage({ id: 'filePanel.workspace.rename' }), e.message, intl.formatMessage({ id: 'filePanel.ok' }), () => {}, '') console.error(e) } } @@ -162,7 +162,7 @@ export function Workspace () { try { await global.dispatchCreateWorkspace(workspaceName, workspaceTemplateName, opts, initGitRepo) } catch (e) { - global.modal('Create Workspace', e.message, 'OK', () => {}, '') + global.modal(intl.formatMessage({ id: 'filePanel.workspace.create' }), e.message, intl.formatMessage({ id: 'filePanel.ok' }), () => {}, '') console.error(e) } } @@ -171,7 +171,7 @@ export function Workspace () { try { await global.dispatchDeleteWorkspace(global.fs.browser.currentWorkspace) } catch (e) { - global.modal('Delete Workspace', e.message, 'OK', () => {}, '') + global.modal(intl.formatMessage({ id: 'filePanel.workspace.delete' }), e.message, intl.formatMessage({ id: 'filePanel.ok' }), () => {}, '') console.error(e) } } @@ -186,7 +186,7 @@ export function Workspace () { await global.dispatchSwitchToWorkspace(name) global.dispatchHandleExpandPath([]) } catch (e) { - global.modal('Switch To Workspace', e.message, 'OK', () => {}, '') + global.modal(intl.formatMessage({ id: 'filePanel.workspace.switch' }), e.message, intl.formatMessage({ id: 'filePanel.ok' }), () => {}, '') console.error(e) } } @@ -217,7 +217,13 @@ export function Workspace () { if (url) { global.dispatchCloneRepository(url) } else { - global.modal('Clone Git Repository', 'Please provide a valid git repository url.', 'OK', () => {}, '') + global.modal( + intl.formatMessage({ id: 'filePanel.workspace.clone' }), + intl.formatMessage({ id: 'filePanel.workspace.cloneMessage' }), + intl.formatMessage({ id: 'filePanel.ok' }), + () => {}, + '' + ) } } @@ -255,7 +261,7 @@ export function Workspace () { } } catch (e) { console.error(e) - global.modal('Checkout Git Branch', e.message, 'OK', () => {}) + global.modal(intl.formatMessage({ id: 'filePanel.checkoutGitBranch' }), e.message, intl.formatMessage({ id: 'filePanel.ok' }), () => {}) } } @@ -264,7 +270,7 @@ export function Workspace () { await global.dispatchCreateNewBranch(branchFilter) _paq.push(['trackEvent', 'Workspace', 'GIT', 'switch_to_new_branch']) } catch (e) { - global.modal('Checkout Git Branch', e.message, 'OK', () => {}) + global.modal(intl.formatMessage({ id: 'filePanel.checkoutGitBranch' }), e.message, intl.formatMessage({ id: 'filePanel.ok' }), () => {}) } } @@ -291,9 +297,9 @@ export function Workspace () {
- + - +
@@ -309,7 +315,7 @@ export function Workspace () {
- +
@@ -323,7 +329,7 @@ export function Workspace () {
- +
@@ -342,12 +348,12 @@ export function Workspace () { className="m-0 form-check-label custom-control-label udapp_checkboxAlign" title="Check option to initialize workspace as a new git repository" > - Initialize workspace as a new git repository +
{!global.fs.gitConfig.username || !global.fs.gitConfig.email ? ( -
Please add username and email to Remix GitHub Settings to use git features.
) +
) :<> } @@ -584,14 +590,14 @@ export function Workspace () {
- Switch branches +
{ toggleBranches(false) }}>
- Create branch: { branchFilter } from '{currentBranch}' + : { branchFilter } from '{currentBranch}'
}
{ - (selectedWorkspace.branches || []).length > 4 &&
+ (selectedWorkspace.branches || []).length > 4 &&
}