permissionHandler intl patch

pull/3342/head
drafish 2 years ago committed by Aniket
parent c495a610c3
commit 148f930385
  1. 7
      apps/remix-ide/src/app/plugins/permission-handler-plugin.tsx
  2. 5
      apps/remix-ide/src/app/tabs/locales/en/permissionHandler.json
  3. 5
      apps/remix-ide/src/app/tabs/locales/zh/permissionHandler.json
  4. 6
      libs/remix-ui/app/src/lib/remix-app/interface/index.ts
  5. 6
      libs/remix-ui/modal-dialog/src/lib/types/index.ts

@ -1,4 +1,5 @@
import React from 'react' // eslint-disable-line import React from 'react' // eslint-disable-line
import { FormattedMessage } from 'react-intl'
import { Plugin } from '@remixproject/engine' import { Plugin } from '@remixproject/engine'
import { AppModal } from '@remix-ui/app' import { AppModal } from '@remix-ui/app'
import { PermissionHandlerDialog, PermissionHandlerValue } from '@remix-ui/permission-handler' import { PermissionHandlerDialog, PermissionHandlerValue } from '@remix-ui/permission-handler'
@ -103,10 +104,10 @@ export class PermissionHandlerPlugin extends Plugin {
} }
const modal: AppModal = { const modal: AppModal = {
id: 'PermissionHandler', id: 'PermissionHandler',
title: `Permission needed for ${to.displayName || to.name}`, title: <FormattedMessage id='permissionHandler.permissionNeededFor' values={{ to: to.displayName || to.name }} />,
message: <PermissionHandlerDialog plugin={this} theme={await this.getTheme()} value={value}></PermissionHandlerDialog>, message: <PermissionHandlerDialog plugin={this} theme={await this.getTheme()} value={value}></PermissionHandlerDialog>,
okLabel: 'Accept', okLabel: <FormattedMessage id='permissionHandler.accept' />,
cancelLabel: 'Decline' cancelLabel: <FormattedMessage id='permissionHandler.decline' />
} }
const result = await this.call('notification', 'modal', modal) const result = await this.call('notification', 'modal', modal)

@ -6,5 +6,8 @@
"permissionHandler.noDescriptionProvided": "No description Provided", "permissionHandler.noDescriptionProvided": "No description Provided",
"permissionHandler.makeSureYouTrustThisPlugin": "Make sure you trust this plugin before processing this call.", "permissionHandler.makeSureYouTrustThisPlugin": "Make sure you trust this plugin before processing this call.",
"permissionHandler.rememberThisChoice": "Remember this choice", "permissionHandler.rememberThisChoice": "Remember this choice",
"permissionHandler.resetAllPermissions": "Reset all Permissions" "permissionHandler.resetAllPermissions": "Reset all Permissions",
"permissionHandler.permissionNeededFor": "Permission needed for {to}",
"permissionHandler.accept": "Accept",
"permissionHandler.decline": "Decline"
} }

@ -6,5 +6,8 @@
"permissionHandler.noDescriptionProvided": "没有提供描述", "permissionHandler.noDescriptionProvided": "没有提供描述",
"permissionHandler.makeSureYouTrustThisPlugin": "在处理此调用之前,请确保您信任此插件。", "permissionHandler.makeSureYouTrustThisPlugin": "在处理此调用之前,请确保您信任此插件。",
"permissionHandler.rememberThisChoice": "记住此选项", "permissionHandler.rememberThisChoice": "记住此选项",
"permissionHandler.resetAllPermissions": "重置所有权限" "permissionHandler.resetAllPermissions": "重置所有权限",
"permissionHandler.permissionNeededFor": "需要 {to} 的权限",
"permissionHandler.accept": "接受",
"permissionHandler.decline": "拒绝"
} }

@ -9,13 +9,13 @@ export interface AppModal {
id: string id: string
timestamp?: number timestamp?: number
hide?: boolean hide?: boolean
title: string title: string | JSX.Element
validationFn?: (value: string) => ValidationResult validationFn?: (value: string) => ValidationResult
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
message: string | JSX.Element message: string | JSX.Element
okLabel: string okLabel: string | JSX.Element
okFn?: (value?:any) => void okFn?: (value?:any) => void
cancelLabel: string cancelLabel: string | JSX.Element
cancelFn?: () => void, cancelFn?: () => void,
modalType?: ModalTypes, modalType?: ModalTypes,
defaultValue?: string defaultValue?: string

@ -7,13 +7,13 @@ export type ValidationResult = {
export interface ModalDialogProps { export interface ModalDialogProps {
id: string id: string
timestamp?: number, timestamp?: number,
title?: string, title?: string | JSX.Element,
validation?: ValidationResult validation?: ValidationResult
validationFn?: (value: string) => ValidationResult validationFn?: (value: string) => ValidationResult
message?: string | JSX.Element, message?: string | JSX.Element,
okLabel?: string, okLabel?: string | JSX.Element,
okFn?: (value?:any) => void, okFn?: (value?:any) => void,
cancelLabel?: string, cancelLabel?: string | JSX.Element,
cancelFn?: () => void, cancelFn?: () => void,
modalClass?: string, modalClass?: string,
showCancelIcon?: boolean, showCancelIcon?: boolean,

Loading…
Cancel
Save