diff --git a/components/chat/chat-ui.tsx b/components/chat/chat-ui.tsx index ac9f13d..d57bcd0 100644 --- a/components/chat/chat-ui.tsx +++ b/components/chat/chat-ui.tsx @@ -19,10 +19,14 @@ import { ChatMessages } from "./chat-messages" import { ChatScrollButtons } from "./chat-scroll-buttons" import { ChatSecondaryButtons } from "./chat-secondary-buttons" +import { useTranslation } from "react-i18next" // 引入 useTranslation 进行国际化处理 + interface ChatUIProps {} export const ChatUI: FC = ({}) => { useHotkey("o", () => handleNewChat()) + + const { t } = useTranslation() // 使用 t 函数进行国际化 const params = useParams() @@ -203,7 +207,7 @@ export const ChatUI: FC = ({}) => {
- {selectedChat?.name || "Chat"} + {selectedChat?.name || t("chat.defaultChatTitle")}
diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index ef6f18f..006197a 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -31,5 +31,9 @@ "usernameError": "Username must be letters, numbers, or underscores only - no other characters or spacing allowed.", "chatDisplayName": "Chat Display Name", "displayNamePlaceholder": "Your Name" + }, + + "chat": { + "defaultChatTitle": "Chat" } } diff --git a/public/locales/ja/translation.json b/public/locales/ja/translation.json index 772091a..51ea392 100644 --- a/public/locales/ja/translation.json +++ b/public/locales/ja/translation.json @@ -30,6 +30,10 @@ "usernameError": "ユーザー名は文字、数字、またはアンダースコアのみで、その他の文字やスペースは使用できません。", "chatDisplayName": "チャット表示名", "displayNamePlaceholder": "あなたの名前" + }, + + "chat": { + "defaultChatTitle": "会話" } } \ No newline at end of file diff --git a/public/locales/zh/translation.json b/public/locales/zh/translation.json index 180466a..3a5a07f 100644 --- a/public/locales/zh/translation.json +++ b/public/locales/zh/translation.json @@ -30,5 +30,9 @@ "usernameError": "用户名只能包含字母、数字或下划线,不能包含其他字符或空格。", "chatDisplayName": "聊天显示名称", "displayNamePlaceholder": "您的名称" + }, + + "chat": { + "defaultChatTitle": "对话" } }