From 1d8daad22347043271c8dcb1b7f28ee57d1cbed4 Mon Sep 17 00:00:00 2001 From: Womsxd <45663319+Womsxd@users.noreply.github.com> Date: Wed, 19 Mar 2025 10:56:35 +0800 Subject: [PATCH] Fix: read flow blank template strings from i18n file (#6240) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### What problem does this PR solve? Blank and createFromNothing were not read from the i18n file when Agent was created 创建Agent的时候 Blank 和 createFromNothing 没从i18n文件中读取 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- web/src/hooks/flow-hooks.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web/src/hooks/flow-hooks.ts b/web/src/hooks/flow-hooks.ts index 5a0964dc0..07905e1ad 100644 --- a/web/src/hooks/flow-hooks.ts +++ b/web/src/hooks/flow-hooks.ts @@ -10,6 +10,7 @@ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'; import { message } from 'antd'; import { set } from 'lodash'; import get from 'lodash/get'; +import { useTranslation } from 'react-i18next'; import { useParams } from 'umi'; import { v4 as uuid } from 'uuid'; @@ -51,6 +52,8 @@ export const EmptyDsl = { }; export const useFetchFlowTemplates = (): ResponseType => { + const { t } = useTranslation(); + const { data } = useQuery({ queryKey: ['fetchFlowTemplates'], initialData: [], @@ -59,8 +62,8 @@ export const useFetchFlowTemplates = (): ResponseType => { if (Array.isArray(data?.data)) { data.data.unshift({ id: uuid(), - title: 'Blank', - description: 'Create your agent from scratch', + title: t('flow.blank'), + description: t('flow.createFromNothing'), dsl: EmptyDsl, }); }