From 8e9887bec69a9fc622b8b7b9972f19e5a3ba6fe5 Mon Sep 17 00:00:00 2001 From: hailin Date: Sat, 19 Apr 2025 11:44:27 +0800 Subject: [PATCH] . --- components/sidebar/sidebar-data-list.tsx | 13 ++++++++++++- public/locales/en/translation.json | 3 ++- public/locales/ja/translation.json | 3 ++- public/locales/zh/translation.json | 3 ++- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/components/sidebar/sidebar-data-list.tsx b/components/sidebar/sidebar-data-list.tsx index ee9ba44..4481506 100644 --- a/components/sidebar/sidebar-data-list.tsx +++ b/components/sidebar/sidebar-data-list.tsx @@ -22,6 +22,8 @@ import { PresetItem } from "./items/presets/preset-item" import { PromptItem } from "./items/prompts/prompt-item" import { ToolItem } from "./items/tools/tool-item" +import { useTranslation } from "react-i18next"; + interface SidebarDataListProps { contentType: ContentType data: DataListType @@ -33,6 +35,9 @@ export const SidebarDataList: FC = ({ data, folders }) => { + + const { t } = useTranslation(); + const { setChats, setPresets, @@ -217,6 +222,12 @@ export const SidebarDataList: FC = ({ const dataWithFolders = data.filter(item => item.folder_id) const dataWithoutFolders = data.filter(item => item.folder_id === null) + // 获取 "No {contentType}" 的国际化文本 + const getNoContentTypeText = (contentType: string) => { + const translatedContentType = t(`contentType.${contentType}`); + return t('side.sidebarNoContentType', { contentType: translatedContentType }) + "."; + }; + return ( <>
= ({ {data.length === 0 && (
- No {contentType}. + {getNoContentTypeText(contentType)}
)} diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index b3cf8b5..c21905a 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -145,7 +145,8 @@ "workspaceNamePlaceholder": "Name...", "workspaceBeginSettings": "These are the settings your workspace begins with when selected.", "workspaceInstructionsPlaceholder": "Instructions... (optional)", - "sidebarCreateNew": "New" + "sidebarCreateNew": "New", + "sidebarNoContentType": "No {{contentType}}" }, "contentType": { diff --git a/public/locales/ja/translation.json b/public/locales/ja/translation.json index 7e2f8f9..cd0e3b4 100644 --- a/public/locales/ja/translation.json +++ b/public/locales/ja/translation.json @@ -144,7 +144,8 @@ "workspaceNamePlaceholder": "名前を入力...", "workspaceBeginSettings": "これらはワークスペースを選択したときに始まる設定です。", "workspaceInstructionsPlaceholder": "説明...(オプション)", - "sidebarCreateNew": "新規作成" + "sidebarCreateNew": "新規作成", + "sidebarNoContentType": "{{contentType}} はありません" }, "contentType": { diff --git a/public/locales/zh/translation.json b/public/locales/zh/translation.json index 6e554c0..4b19244 100644 --- a/public/locales/zh/translation.json +++ b/public/locales/zh/translation.json @@ -144,7 +144,8 @@ "workspaceNamePlaceholder": "请输入名称...", "workspaceBeginSettings": "这些是选择此工作区时的初始设置。", "workspaceInstructionsPlaceholder": "说明...(可选)", - "sidebarCreateNew": "新建" + "sidebarCreateNew": "新建", + "sidebarNoContentType": "没有 {{contentType}}" }, "contentType": {