add some pluginManager locale messages

pull/3171/head
drafish 2 years ago
parent 7e39bb09a8
commit f0048f06cb
  1. 11
      apps/remix-ide/src/app/tabs/locales/en/pluginManager.json
  2. 11
      apps/remix-ide/src/app/tabs/locales/zh/pluginManager.json
  3. 18
      libs/remix-ui/plugin-manager/src/lib/components/permissionsSettings.tsx

@ -18,5 +18,14 @@
"pluginManager.localForm.locationInRemix": "Location in remix", "pluginManager.localForm.locationInRemix": "Location in remix",
"pluginManager.localForm.sidePanel": "Side Panel", "pluginManager.localForm.sidePanel": "Side Panel",
"pluginManager.localForm.mainPanel": "Main Panel", "pluginManager.localForm.mainPanel": "Main Panel",
"pluginManager.localForm.none": "None" "pluginManager.localForm.none": "None",
"pluginManager.Permissions": "Permissions",
"pluginManager.permissions": "permissions",
"pluginManager.pluginManagerPermissions": "Plugin Manager Permissions",
"pluginManager.currentPermissionSettings": "Current Permission Settings",
"pluginManager.noPermissionRequestedYet": "No Permission requested yet.",
"pluginManager.allow": "Allow",
"pluginManager.toCall": "to call",
"pluginManager.ok": "OK",
"pluginManager.cancel": "Cancel"
} }

@ -18,5 +18,14 @@
"pluginManager.localForm.locationInRemix": "在Remix中的位置", "pluginManager.localForm.locationInRemix": "在Remix中的位置",
"pluginManager.localForm.sidePanel": "侧面板", "pluginManager.localForm.sidePanel": "侧面板",
"pluginManager.localForm.mainPanel": "主面板", "pluginManager.localForm.mainPanel": "主面板",
"pluginManager.localForm.none": "无" "pluginManager.localForm.none": "无",
"pluginManager.Permissions": "权限",
"pluginManager.permissions": "权限",
"pluginManager.pluginManagerPermissions": "插件管理权限",
"pluginManager.currentPermissionSettings": "当前权限设置",
"pluginManager.noPermissionRequestedYet": "目前还没有权限请求。",
"pluginManager.allow": "允许",
"pluginManager.toCall": "调用",
"pluginManager.ok": "确认",
"pluginManager.cancel": "取消"
} }

@ -1,5 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-vars */ /* eslint-disable @typescript-eslint/no-unused-vars */
import React, { Fragment, useState } from 'react' // eslint-disable-line no-use-before-define import React, { Fragment, useState } from 'react' // eslint-disable-line no-use-before-define
import { FormattedMessage, useIntl } from 'react-intl'
/* eslint-disable-line */ /* eslint-disable-line */
import { ModalDialog } from '@remix-ui/modal-dialog' import { ModalDialog } from '@remix-ui/modal-dialog'
import useLocalStorage from '../custom-hooks/useLocalStorage' import useLocalStorage from '../custom-hooks/useLocalStorage'
@ -9,6 +10,7 @@ function PermisssionsSettings () {
const [modalVisibility, setModalVisibility] = useState<boolean>(true) const [modalVisibility, setModalVisibility] = useState<boolean>(true)
const [permissions, setPermissions] = useLocalStorage<PluginPermissions>('plugins/permissions', {} as PluginPermissions) const [permissions, setPermissions] = useLocalStorage<PluginPermissions>('plugins/permissions', {} as PluginPermissions)
const [permissionCache, setpermissionCache] = useState<PluginPermissions>() const [permissionCache, setpermissionCache] = useState<PluginPermissions>()
const intl = useIntl()
const closeModal = () => setModalVisibility(true) const closeModal = () => setModalVisibility(true)
const openModal = () => { const openModal = () => {
const currentValue = JSON.parse(window.localStorage.getItem('plugins/permissions') || '{}') const currentValue = JSON.parse(window.localStorage.getItem('plugins/permissions') || '{}')
@ -51,7 +53,7 @@ function PermisssionsSettings () {
function RenderPluginHeader ({ headingName }) { function RenderPluginHeader ({ headingName }) {
return ( return (
<div className="pb-2 remixui_permissionKey"> <div className="pb-2 remixui_permissionKey">
<h3>{headingName} permissions:</h3> <h3>{headingName} <FormattedMessage id="pluginManager.permissions" />:</h3>
<i <i
onClick={() => { onClick={() => {
clearTargetPermission(headingName) clearTargetPermission(headingName)
@ -83,7 +85,7 @@ function PermisssionsSettings () {
htmlFor={`permission-checkbox-${targetPlugin}-${funcName}-${targetPlugin}`} htmlFor={`permission-checkbox-${targetPlugin}-${funcName}-${targetPlugin}`}
data-id={`permission-label-${targetPlugin}-${funcName}-${targetPlugin}`} data-id={`permission-label-${targetPlugin}-${funcName}-${targetPlugin}`}
> >
Allow <u>{pluginName}</u> to call <u>{funcName}</u> <FormattedMessage id="pluginManager.allow" /> <u>{pluginName}</u> <FormattedMessage id="pluginManager.toCall" /> <u>{funcName}</u>
</label> </label>
</span> </span>
</div><i </div><i
@ -106,13 +108,13 @@ function PermisssionsSettings () {
handleHide={closeModal} handleHide={closeModal}
cancelFn={cancel} cancelFn={cancel}
hide={modalVisibility} hide={modalVisibility}
title="Plugin Manager Permissions" title={intl.formatMessage({ id: 'pluginManager.pluginManagerPermissions' })}
okLabel="OK" okLabel={intl.formatMessage({ id: 'pluginManager.ok' })}
cancelLabel="Cancel" cancelLabel={intl.formatMessage({ id: 'pluginManager.cancel' })}
> >
{permissions && Object.keys(permissions).length > 0 {permissions && Object.keys(permissions).length > 0
? (<h4 className="text-center">Current Permission Settings</h4>) ? (<h4 className="text-center"><FormattedMessage id="pluginManager.currentPermissionSettings" /></h4>)
: (<h4 className="text-center">No Permission requested yet.</h4>) : (<h4 className="text-center"><FormattedMessage id="pluginManager.noPermissionRequestedYet" /></h4>)
} }
<form className="remixui_permissionForm" data-id="pluginManagerSettingsPermissionForm"> <form className="remixui_permissionForm" data-id="pluginManagerSettingsPermissionForm">
<div className="p-2"> <div className="p-2">
@ -132,7 +134,7 @@ function PermisssionsSettings () {
onClick={openModal} onClick={openModal}
className="btn btn-primary settings-button" className="btn btn-primary settings-button"
data-id="pluginManagerPermissionsButton"> data-id="pluginManagerPermissionsButton">
Permissions <FormattedMessage id="pluginManager.Permissions" />
</button> </button>
</footer> </footer>
</Fragment> </Fragment>

Loading…
Cancel
Save