From fc04a81d9bff37f9010f3651b1b3c4907b250b32 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Wed, 2 Feb 2022 18:07:46 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=BD=91=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E5=A2=9E=E5=8A=A0=E5=9B=BD=E9=99=85=E5=8C=96=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/plugins/com.msgbyte.webview/src/index.tsx | 5 +++-- web/plugins/com.msgbyte.webview/src/translate.ts | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 web/plugins/com.msgbyte.webview/src/translate.ts diff --git a/web/plugins/com.msgbyte.webview/src/index.tsx b/web/plugins/com.msgbyte.webview/src/index.tsx index 31eff60b..72058c60 100644 --- a/web/plugins/com.msgbyte.webview/src/index.tsx +++ b/web/plugins/com.msgbyte.webview/src/index.tsx @@ -1,5 +1,6 @@ import React from 'react'; import { regGroupPanel, useCurrentGroupPanelInfo } from '@capital/common'; +import { Translate } from './translate'; const PLUGIN_NAME = 'com.msgbyte.webview'; @@ -7,7 +8,7 @@ const GroupWebPanelRender = () => { const groupPanelInfo = useCurrentGroupPanelInfo(); if (!groupPanelInfo) { - return
加载失败, 面板信息不存在
; + return
{Translate.notfound}
; } const url = groupPanelInfo.meta?.url; @@ -19,7 +20,7 @@ const GroupWebPanelRender = () => { regGroupPanel({ name: `${PLUGIN_NAME}/grouppanel`, - label: '网页面板', + label: Translate.webpanel, provider: PLUGIN_NAME, extraFormMeta: [{ type: 'text', name: 'url', label: '网址' }], render: GroupWebPanelRender, diff --git a/web/plugins/com.msgbyte.webview/src/translate.ts b/web/plugins/com.msgbyte.webview/src/translate.ts new file mode 100644 index 00000000..31549c40 --- /dev/null +++ b/web/plugins/com.msgbyte.webview/src/translate.ts @@ -0,0 +1,9 @@ +import { localTrans } from '@capital/common'; + +export const Translate = { + webpanel: localTrans({ 'zh-CN': '网页面板', 'en-US': 'Webview Panel' }), + notfound: localTrans({ + 'zh-CN': '加载失败, 面板信息不存在', + 'en-US': 'Loading failed, panel info does not exist', + }), +};