This commit is contained in:
parent
d53a4e5507
commit
8e9887bec6
|
|
@ -22,6 +22,8 @@ import { PresetItem } from "./items/presets/preset-item"
|
||||||
import { PromptItem } from "./items/prompts/prompt-item"
|
import { PromptItem } from "./items/prompts/prompt-item"
|
||||||
import { ToolItem } from "./items/tools/tool-item"
|
import { ToolItem } from "./items/tools/tool-item"
|
||||||
|
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
interface SidebarDataListProps {
|
interface SidebarDataListProps {
|
||||||
contentType: ContentType
|
contentType: ContentType
|
||||||
data: DataListType
|
data: DataListType
|
||||||
|
|
@ -33,6 +35,9 @@ export const SidebarDataList: FC<SidebarDataListProps> = ({
|
||||||
data,
|
data,
|
||||||
folders
|
folders
|
||||||
}) => {
|
}) => {
|
||||||
|
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
setChats,
|
setChats,
|
||||||
setPresets,
|
setPresets,
|
||||||
|
|
@ -217,6 +222,12 @@ export const SidebarDataList: FC<SidebarDataListProps> = ({
|
||||||
const dataWithFolders = data.filter(item => item.folder_id)
|
const dataWithFolders = data.filter(item => item.folder_id)
|
||||||
const dataWithoutFolders = data.filter(item => item.folder_id === null)
|
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 (
|
return (
|
||||||
<>
|
<>
|
||||||
<div
|
<div
|
||||||
|
|
@ -227,7 +238,7 @@ export const SidebarDataList: FC<SidebarDataListProps> = ({
|
||||||
{data.length === 0 && (
|
{data.length === 0 && (
|
||||||
<div className="flex grow flex-col items-center justify-center">
|
<div className="flex grow flex-col items-center justify-center">
|
||||||
<div className=" text-centertext-muted-foreground p-8 text-lg italic">
|
<div className=" text-centertext-muted-foreground p-8 text-lg italic">
|
||||||
No {contentType}.
|
{getNoContentTypeText(contentType)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,8 @@
|
||||||
"workspaceNamePlaceholder": "Name...",
|
"workspaceNamePlaceholder": "Name...",
|
||||||
"workspaceBeginSettings": "These are the settings your workspace begins with when selected.",
|
"workspaceBeginSettings": "These are the settings your workspace begins with when selected.",
|
||||||
"workspaceInstructionsPlaceholder": "Instructions... (optional)",
|
"workspaceInstructionsPlaceholder": "Instructions... (optional)",
|
||||||
"sidebarCreateNew": "New"
|
"sidebarCreateNew": "New",
|
||||||
|
"sidebarNoContentType": "No {{contentType}}"
|
||||||
},
|
},
|
||||||
|
|
||||||
"contentType": {
|
"contentType": {
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,8 @@
|
||||||
"workspaceNamePlaceholder": "名前を入力...",
|
"workspaceNamePlaceholder": "名前を入力...",
|
||||||
"workspaceBeginSettings": "これらはワークスペースを選択したときに始まる設定です。",
|
"workspaceBeginSettings": "これらはワークスペースを選択したときに始まる設定です。",
|
||||||
"workspaceInstructionsPlaceholder": "説明...(オプション)",
|
"workspaceInstructionsPlaceholder": "説明...(オプション)",
|
||||||
"sidebarCreateNew": "新規作成"
|
"sidebarCreateNew": "新規作成",
|
||||||
|
"sidebarNoContentType": "{{contentType}} はありません"
|
||||||
},
|
},
|
||||||
|
|
||||||
"contentType": {
|
"contentType": {
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,8 @@
|
||||||
"workspaceNamePlaceholder": "请输入名称...",
|
"workspaceNamePlaceholder": "请输入名称...",
|
||||||
"workspaceBeginSettings": "这些是选择此工作区时的初始设置。",
|
"workspaceBeginSettings": "这些是选择此工作区时的初始设置。",
|
||||||
"workspaceInstructionsPlaceholder": "说明...(可选)",
|
"workspaceInstructionsPlaceholder": "说明...(可选)",
|
||||||
"sidebarCreateNew": "新建"
|
"sidebarCreateNew": "新建",
|
||||||
|
"sidebarNoContentType": "没有 {{contentType}}"
|
||||||
},
|
},
|
||||||
|
|
||||||
"contentType": {
|
"contentType": {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue