From a8a956b5f1a51232d8b27d02dc2438dd38e8c6f5 Mon Sep 17 00:00:00 2001 From: AkaraChen Date: Wed, 25 Dec 2024 14:05:49 +0800 Subject: [PATCH] chore: add i18n --- .../components/agent-strategy-selector.tsx | 9 +++++---- .../nodes/_base/components/agent-strategy.tsx | 18 ++++++++---------- .../_base/components/install-plugin-button.tsx | 5 +++-- .../components/workflow/nodes/agent/panel.tsx | 1 - web/i18n/en-US/workflow.ts | 7 +++++++ web/i18n/zh-Hans/workflow.ts | 7 +++++++ 6 files changed, 30 insertions(+), 17 deletions(-) diff --git a/web/app/components/workflow/nodes/_base/components/agent-strategy-selector.tsx b/web/app/components/workflow/nodes/_base/components/agent-strategy-selector.tsx index 7baa6182ec..8976289149 100644 --- a/web/app/components/workflow/nodes/_base/components/agent-strategy-selector.tsx +++ b/web/app/components/workflow/nodes/_base/components/agent-strategy-selector.tsx @@ -11,15 +11,16 @@ import ViewTypeSelect, { ViewType } from '../../../block-selector/view-type-sele import SearchInput from '@/app/components/base/search-input' import { MARKETPLACE_URL_PREFIX } from '@/config' import Tools from '../../../block-selector/tools' +import { useTranslation } from 'react-i18next' const ExternalNotInstallWarn = () => { - // TODO: add i18n label + const { t } = useTranslation() return -

This plugin is not installed

-

This plugin is installed from GitHub. Please go to Plugins to reinstall

+

{t('workflow.nodes.agent.pluginNotInstalled')}

+

{t('workflow.nodes.agent.pluginNotInstalledDesc')}

- Link to Plugins + {t('workflow.nodes.agent.linkToPlugin')}

} needsDelay diff --git a/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx b/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx index ee24ac3d6a..636baaa08b 100644 --- a/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx +++ b/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx @@ -4,7 +4,7 @@ import ListEmpty from '@/app/components/base/list-empty' import { AgentStrategySelector } from './agent-strategy-selector' import Link from 'next/link' import { useTranslation } from 'react-i18next' -import InputVarList from '../../tool/components/input-var-list' +import Form from '@/app/components/header/account-setting/model-provider-page/model-modal/Form' export type Strategy = { agent_strategy_provider_name: string @@ -19,26 +19,24 @@ export type AgentStrategyProps = { formSchema: CredentialFormSchema[] formValue: ToolVarInputs onFormValueChange: (value: ToolVarInputs) => void - /** - * @description use for get available vars - */ - nodeId: string } export const AgentStrategy = (props: AgentStrategyProps) => { - const { strategy, onStrategyChange, formSchema, formValue, onFormValueChange, nodeId } = props + const { strategy, onStrategyChange, formSchema, formValue, onFormValueChange } = props const { t } = useTranslation() return
{ strategy ?
-
// TODO: list empty need a icon diff --git a/web/app/components/workflow/nodes/_base/components/install-plugin-button.tsx b/web/app/components/workflow/nodes/_base/components/install-plugin-button.tsx index 08095b8e0b..1ae5fab864 100644 --- a/web/app/components/workflow/nodes/_base/components/install-plugin-button.tsx +++ b/web/app/components/workflow/nodes/_base/components/install-plugin-button.tsx @@ -2,14 +2,15 @@ import Button from '@/app/components/base/button' import { RiInstallLine, RiLoader2Line } from '@remixicon/react' import type { ComponentProps } from 'react' import classNames from '@/utils/classnames' +import { useTranslation } from 'react-i18next' type InstallPluginButtonProps = Omit, 'children'> export const InstallPluginButton = (props: InstallPluginButtonProps) => { const { loading, className, ...rest } = props - // TODO: add i18n label + const { t } = useTranslation() return } diff --git a/web/app/components/workflow/nodes/agent/panel.tsx b/web/app/components/workflow/nodes/agent/panel.tsx index 54c42c9953..277c745fe1 100644 --- a/web/app/components/workflow/nodes/agent/panel.tsx +++ b/web/app/components/workflow/nodes/agent/panel.tsx @@ -289,7 +289,6 @@ const AgentPanel: FC> = (props) => { ...inputs, agent_parameters: value, })} - nodeId={props.id} /> diff --git a/web/i18n/en-US/workflow.ts b/web/i18n/en-US/workflow.ts index d651f038c6..2566dc67e5 100644 --- a/web/i18n/en-US/workflow.ts +++ b/web/i18n/en-US/workflow.ts @@ -703,6 +703,13 @@ const translation = { configureTipDesc: 'After configuring the agentic strategy, this node will automatically load the remaining configurations. The strategy will affect the mechanism of multi-step tool reasoning. ', }, learnMore: 'Learn more', + pluginNotInstalled: 'This plugin is not installed', + pluginNotInstalledDesc: 'This plugin is installed from GitHub. Please go to Plugins to reinstall', + linkToPlugin: 'Link to Plugins', + pluginInstaller: { + install: 'Install', + installing: 'Installing', + }, }, }, tracing: { diff --git a/web/i18n/zh-Hans/workflow.ts b/web/i18n/zh-Hans/workflow.ts index 37e84d5ee6..f2e1cf4881 100644 --- a/web/i18n/zh-Hans/workflow.ts +++ b/web/i18n/zh-Hans/workflow.ts @@ -703,6 +703,13 @@ const translation = { configureTipDesc: '配置完成后,此节点将自动加载剩余配置。策略将影响多步工具推理的机制。', }, learnMore: '了解更多', + pluginNotInstalled: '插件未安装', + pluginNotInstalledDesc: '此插件是从 GitHub 安装的。请转到插件重新安装', + linkToPlugin: '转到插件', + pluginInstaller: { + install: '安装', + installing: '安装中', + }, }, }, tracing: {