diff --git a/components/sidebar/sidebar-create-buttons.tsx b/components/sidebar/sidebar-create-buttons.tsx index 9343654..fedd975 100644 --- a/components/sidebar/sidebar-create-buttons.tsx +++ b/components/sidebar/sidebar-create-buttons.tsx @@ -13,6 +13,8 @@ import { CreatePreset } from "./items/presets/create-preset" import { CreatePrompt } from "./items/prompts/create-prompt" import { CreateTool } from "./items/tools/create-tool" +import { useTranslation } from "react-i18next"; + interface SidebarCreateButtonsProps { contentType: ContentType hasData: boolean @@ -22,7 +24,10 @@ export const SidebarCreateButtons: FC = ({ contentType, hasData }) => { - const { profile, selectedWorkspace, folders, setFolders } = + + const { t, i18n } = useTranslation(); + + const { profile, selectedWorkspace, folders, setFolders } = useContext(ChatbotUIContext) const { handleNewChat } = useChatHandler() @@ -95,13 +100,31 @@ export const SidebarCreateButtons: FC = ({ } } + // 获取当前语言 + const language = i18n.language; + + // 判断需要大写首字母的语言 + const needsUpperCaseFirstLetter = (language: string) => { + const languagesRequiringUpperCase = ['en', 'de', 'fr', 'es', 'it']; // 其他需要大写首字母的语言 + return languagesRequiringUpperCase.includes(language); + }; + + // 对动态内容进行首字母大写的处理 + const getCapitalizedContentType = (contentType: string, language: string) => { + if (needsUpperCaseFirstLetter(language)) { + return contentType.charAt(0).toUpperCase() + contentType.slice(1, contentType.length - 1); // 保留去掉最后一个字符 + } + return contentType; // 不需要大写的语言返回原始值 + }; + return (
{hasData && ( diff --git a/components/workspace/workspace-settings.tsx b/components/workspace/workspace-settings.tsx index 90d8c0c..458419d 100644 --- a/components/workspace/workspace-settings.tsx +++ b/components/workspace/workspace-settings.tsx @@ -291,12 +291,11 @@ export const WorkspaceSettings: FC = ({}) => {
diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index cad5942..285e6b1 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -144,7 +144,8 @@ "aiResponseInstructions": "How would you like the AI to respond in this workspace?", "workspaceNamePlaceholder": "Name...", "workspaceBeginSettings": "These are the settings your workspace begins with when selected.", - "workspaceInstructionsPlaceholder": "Instructions... (optional)" + "workspaceInstructionsPlaceholder": "Instructions... (optional)", + "sidebarCreateNew": "New" } } diff --git a/public/locales/ja/translation.json b/public/locales/ja/translation.json index d223fac..f3c760e 100644 --- a/public/locales/ja/translation.json +++ b/public/locales/ja/translation.json @@ -143,7 +143,8 @@ "aiResponseInstructions": "このワークスペースでAIにどのように応答してほしいですか?", "workspaceNamePlaceholder": "名前を入力...", "workspaceBeginSettings": "これらはワークスペースを選択したときに始まる設定です。", - "workspaceInstructionsPlaceholder": "説明...(オプション)" + "workspaceInstructionsPlaceholder": "説明...(オプション)", + "sidebarCreateNew": "新規作成" } } diff --git a/public/locales/zh/translation.json b/public/locales/zh/translation.json index 9113610..6e790a9 100644 --- a/public/locales/zh/translation.json +++ b/public/locales/zh/translation.json @@ -143,7 +143,8 @@ "aiResponseInstructions": "您希望 AI 在此工作区内如何回应?", "workspaceNamePlaceholder": "请输入名称...", "workspaceBeginSettings": "这些是选择此工作区时的初始设置。", - "workspaceInstructionsPlaceholder": "说明...(可选)" + "workspaceInstructionsPlaceholder": "说明...(可选)", + "sidebarCreateNew": "新建" } }