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 f16b705675..2672873f71 100644 --- a/apps/remix-ide/src/app/tabs/locales/en-US.js +++ b/apps/remix-ide/src/app/tabs/locales/en-US.js @@ -16,6 +16,34 @@ export default { 'settings.locales': 'Lanaguage', 'filePanel.displayName': 'File explorers', + 'filePanel.workspace': 'Workspaces', + 'filePanel.create': 'Create', + 'filePanel.workspace.create': 'Create Workspace', + 'filePanel.workspace.rename': 'Rename Current Workspace', + 'filePanel.workspace.delete': 'Delete Current Workspace', + 'filePanel.workspace.deleteConfirm': 'Are you sure to delete the current workspace?', + 'filePanel.workspace.name': 'Workspace name', + 'filePanel.workspace.chooseTemplate': 'Choose a template', + 'filePanel.workspace.download': 'Download Workspaces', + 'filePanel.workspace.restore': 'Restore Workspaces Backup', + 'filePanel.newFile': 'New File', + 'filePanel.newFolder': 'New Folder', + 'filePanel.rename': 'Rename', + 'filePanel.delete': 'Delete', + 'filePanel.deleteAll': 'Delete All', + 'filePanel.run': 'Run', + 'filePanel.pushChangesToGist': 'Push changes to gist', + 'filePanel.publishFolderToGist': 'Publish folder to gist', + 'filePanel.publishFileToGist': 'Publish file to gist', + 'filePanel.copy': 'Copy', + 'filePanel.paste': 'Paste', + 'filePanel.compile': 'Compile', + 'filePanel.compileForNahmii': 'Compile for Nahmii', + 'filePanel.createNewFile': 'Create New File', + 'filePanel.createNewFolder': 'Create New Folder', + 'filePanel.publishToGist': 'Publish all the current workspace files (only root) to a github gist', + 'filePanel.uploadFile': 'Load a local file into current workspace', + 'filePanel.updateGist': 'Update the current [gist] explorer', 'debugger.displayName': 'Debugger', 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 28109ac315..87c7c622a1 100644 --- a/apps/remix-ide/src/app/tabs/locales/zh-CN.js +++ b/apps/remix-ide/src/app/tabs/locales/zh-CN.js @@ -16,6 +16,34 @@ export default { 'settings.locales': '语言', 'filePanel.displayName': '文件浏览器', + 'filePanel.workspace': '工作空间', + 'filePanel.create': '新建', + 'filePanel.workspace.create': '新建工作空间', + 'filePanel.workspace.rename': '重命名当前工作空间', + 'filePanel.workspace.delete': '删除当前工作空间', + 'filePanel.workspace.deleteConfirm': '确定要删除当前工作空间?', + 'filePanel.workspace.name': '工作空间名称', + 'filePanel.workspace.chooseTemplate': '选择一个工作空间模板', + 'filePanel.workspace.download': '下载工作空间', + 'filePanel.workspace.restore': '恢复工作空间', + 'filePanel.newFile': '新建文件', + 'filePanel.newFolder': '新建文件夹', + 'filePanel.rename': '重命名', + 'filePanel.delete': '删除', + 'filePanel.deleteAll': '删除所有', + 'filePanel.run': '运行', + 'filePanel.pushChangesToGist': '将修改推送到gist', + 'filePanel.publishFolderToGist': '将当前目录发布到gist', + 'filePanel.publishFileToGist': '将当前文件发布到gist', + 'filePanel.copy': '复制', + 'filePanel.paste': '黏贴', + 'filePanel.compile': '编译', + 'filePanel.compileForNahmii': 'Nahmii编译', + 'filePanel.createNewFile': '新建文件', + 'filePanel.createNewFolder': '新建文件夹', + 'filePanel.publishToGist': '将当前工作空间下所有文件发布到github gist', + 'filePanel.uploadFile': '加载本地文件到当前工作空间', + 'filePanel.updateGist': '更新当前 [gist] 浏览', 'debugger.displayName': '调试器', diff --git a/libs/remix-ui/panel/src/lib/plugins/panel-header.tsx b/libs/remix-ui/panel/src/lib/plugins/panel-header.tsx index 3833373e62..75851edbe6 100644 --- a/libs/remix-ui/panel/src/lib/plugins/panel-header.tsx +++ b/libs/remix-ui/panel/src/lib/plugins/panel-header.tsx @@ -22,6 +22,7 @@ const RemixUIPanelHeader = (props: RemixPanelProps) => { return (
+ {/* @ts-ignore */}
{plugin?.profile.documentation ? () : ''} diff --git a/libs/remix-ui/workspace/src/lib/components/file-explorer-context-menu.tsx b/libs/remix-ui/workspace/src/lib/components/file-explorer-context-menu.tsx index 5e6518c2de..3810d4cf79 100644 --- a/libs/remix-ui/workspace/src/lib/components/file-explorer-context-menu.tsx +++ b/libs/remix-ui/workspace/src/lib/components/file-explorer-context-menu.tsx @@ -1,4 +1,5 @@ import React, { useRef, useEffect } from 'react' // eslint-disable-line +import { useIntl } from 'react-intl' import { action, FileExplorerContextMenuProps } from '../types' import '../css/file-explorer-context-menu.css' @@ -14,6 +15,7 @@ const _paq = window._paq = window._paq || [] //eslint-disable-line export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) => { const { actions, createNewFile, createNewFolder, deletePath, renamePath, hideContextMenu, pushChangesToGist, publishFileToGist, publishFolderToGist, copy, paste, runScript, emit, pageX, pageY, path, type, focus, ...otherProps } = props const contextMenuRef = useRef(null) + const intl = useIntl() useEffect(() => { contextMenuRef.current.focus() }, []) @@ -113,7 +115,7 @@ export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) => break } hideContextMenu() - }}>{item.label || item.name} + }}>{intl.formatMessage({id: `filePanel.${item.id}`, defaultMessage: item.label || item.name})} }) } diff --git a/libs/remix-ui/workspace/src/lib/components/file-explorer-menu.tsx b/libs/remix-ui/workspace/src/lib/components/file-explorer-menu.tsx index 69418cd3c7..c58c69820b 100644 --- a/libs/remix-ui/workspace/src/lib/components/file-explorer-menu.tsx +++ b/libs/remix-ui/workspace/src/lib/components/file-explorer-menu.tsx @@ -1,7 +1,9 @@ import React, { useState, useEffect } from 'react' //eslint-disable-line +import { useIntl } from 'react-intl' import { FileExplorerMenuProps } from '../types' export const FileExplorerMenu = (props: FileExplorerMenuProps) => { + const intl = useIntl() const [state, setState] = useState({ menuItems: [ { @@ -54,7 +56,7 @@ export const FileExplorerMenu = (props: FileExplorerMenuProps) => { id={action} data-id={'fileExplorerUploadFile' + action } className={icon + ' mb-0 remixui_newFile'} - title={title} + title={intl.formatMessage({id: `filePanel.${action}`, defaultMessage: title})} key={index} > { @@ -83,7 +85,7 @@ export const FileExplorerMenu = (props: FileExplorerMenuProps) => { } }} className={'newFile ' + icon + ' remixui_newFile'} - title={title} + title={intl.formatMessage({id: `filePanel.${action}`, defaultMessage: title})} key={index} > 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 98a80306bd..687d7b1707 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -1,4 +1,5 @@ import React, { useState, useEffect, useRef, useContext } from 'react' // eslint-disable-line +import { FormattedMessage, useIntl } from 'react-intl' import { FileExplorer } from './components/file-explorer' // eslint-disable-line import './css/remix-ui-workspace.css' import { FileSystemContext } from './contexts' @@ -13,6 +14,7 @@ export function Workspace () { const workspaceRenameInput = useRef() const workspaceCreateInput = useRef() const workspaceCreateTemplateInput = useRef() + const intl = useIntl() useEffect(() => { resetFocus() @@ -40,15 +42,21 @@ export function Workspace () { }, [global.fs.browser.workspaces]) const renameCurrentWorkspace = () => { - global.modal('Rename Current Workspace', renameModalMessage(), 'OK', onFinishRenameWorkspace, '') + global.modal(intl.formatMessage({id: 'filePanel.workspace.rename', defaultMessage: 'Rename Current Workspace'}), renameModalMessage(), 'OK', onFinishRenameWorkspace, '') } const createWorkspace = () => { - global.modal('Create Workspace', createModalMessage(), 'OK', onFinishCreateWorkspace, '') + global.modal(intl.formatMessage({id: 'filePanel.workspace.create', defaultMessage: 'Create Workspace'}), createModalMessage(), 'OK', onFinishCreateWorkspace, '') } const deleteCurrentWorkspace = () => { - global.modal('Delete Current Workspace', 'Are you sure to delete the current workspace?', 'OK', onFinishDeleteWorkspace, '') + global.modal( + intl.formatMessage({id: 'filePanel.workspace.delete', defaultMessage: 'Delete Current Workspace'}), + intl.formatMessage({id: 'filePanel.workspace.deleteConfirm', defaultMessage: 'Are you sure to delete the current workspace?'}), + 'OK', + onFinishDeleteWorkspace, + '' + ) } const downloadWorkspaces = async () => { @@ -127,9 +135,9 @@ export function Workspace () { const createModalMessage = () => { return ( <> - +
- + switchWorkspace(e.target.value)} className="form-control custom-select">