From 148f93038524300b9305e1218f309566d5e6fae2 Mon Sep 17 00:00:00 2001 From: drafish Date: Thu, 15 Dec 2022 11:33:26 +0800 Subject: [PATCH] permissionHandler intl patch --- .../src/app/plugins/permission-handler-plugin.tsx | 7 ++++--- .../src/app/tabs/locales/en/permissionHandler.json | 5 ++++- .../src/app/tabs/locales/zh/permissionHandler.json | 5 ++++- libs/remix-ui/app/src/lib/remix-app/interface/index.ts | 6 +++--- libs/remix-ui/modal-dialog/src/lib/types/index.ts | 6 +++--- 5 files changed, 18 insertions(+), 11 deletions(-) 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/permissionHandler.json b/apps/remix-ide/src/app/tabs/locales/en/permissionHandler.json index 0d59c8e7d7..70a0e690f9 100644 --- a/apps/remix-ide/src/app/tabs/locales/en/permissionHandler.json +++ b/apps/remix-ide/src/app/tabs/locales/en/permissionHandler.json @@ -6,5 +6,8 @@ "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.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/zh/permissionHandler.json b/apps/remix-ide/src/app/tabs/locales/zh/permissionHandler.json index 382170cb90..316206ef48 100644 --- a/apps/remix-ide/src/app/tabs/locales/zh/permissionHandler.json +++ b/apps/remix-ide/src/app/tabs/locales/zh/permissionHandler.json @@ -6,5 +6,8 @@ "permissionHandler.noDescriptionProvided": "没有提供描述", "permissionHandler.makeSureYouTrustThisPlugin": "在处理此调用之前,请确保您信任此插件。", "permissionHandler.rememberThisChoice": "记住此选项", - "permissionHandler.resetAllPermissions": "重置所有权限" + "permissionHandler.resetAllPermissions": "重置所有权限", + "permissionHandler.permissionNeededFor": "需要 {to} 的权限", + "permissionHandler.accept": "接受", + "permissionHandler.decline": "拒绝" } 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/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,