diff --git a/components/utility/profile-settings.tsx b/components/utility/profile-settings.tsx index 7fadb9e..059dd1d 100644 --- a/components/utility/profile-settings.tsx +++ b/components/utility/profile-settings.tsx @@ -45,9 +45,15 @@ import { ThemeSwitcher } from "./theme-switcher" import { usePathname } from "next/navigation" // 导入 usePathname +import { useTranslation } from "react-i18next"; // 引入useTranslation用于国际化 + + interface ProfileSettingsProps {} export const ProfileSettings: FC = ({}) => { + + const { t } = useTranslation(); // 使用t函数来获取翻译文本 + const { profile, setProfile, @@ -309,7 +315,8 @@ export const ProfileSettings: FC = ({}) => { src={profile.image_url + "?" + new Date().getTime()} height={34} width={34} - alt={"Image"} + alt={t("profile.imageAlt")} + //alt={"Image"} /> ) : ( - Profile - API Keys + {t("profile.profileTab")} + {t("profile.apiKeysTab")}
- +
{username !== profile.username ? ( usernameAvailable ? ( -
AVAILABLE
+
{t("profile.available")}
) : ( -
UNAVAILABLE
+
{t("profile.unavailable")}
) ) : null}
@@ -365,7 +372,7 @@ export const ProfileSettings: FC = ({}) => {
{ setUsername(e.target.value) @@ -395,7 +402,7 @@ export const ProfileSettings: FC = ({}) => {
- + = ({}) => {
- + setDisplayName(e.target.value)} maxLength={PROFILE_DISPLAY_NAME_MAX} @@ -420,14 +427,13 @@ export const ProfileSettings: FC = ({}) => {
@@ -756,11 +762,11 @@ export const ProfileSettings: FC = ({}) => {
diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index 006197a..ce50baa 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -35,5 +35,24 @@ "chat": { "defaultChatTitle": "Chat" - } + }, + + "profile": { + "settingsTitle": "User Settings", + "logout": "Logout", + "profileTab": "Profile", + "apiKeysTab": "API Keys", + "usernameLabel": "Username", + "usernamePlaceholder": "Enter username", + "available": "AVAILABLE", + "unavailable": "UNAVAILABLE", + "usernameError": "Username must be letters, numbers, or underscores only - no other characters or spacing allowed.", + "chatDisplayName": "Chat Display Name", + "chatDisplayNamePlaceholder": "Your Name", + "instructionsLabel": "What would you like the AI to know about you to provide better responses?", + "instructionsPlaceholder": "Profile context... (optional)", + "profileImageLabel": "Profile Image", + "cancel": "Cancel", + "save": "Save" + } } diff --git a/public/locales/ja/translation.json b/public/locales/ja/translation.json index 51ea392..c72639c 100644 --- a/public/locales/ja/translation.json +++ b/public/locales/ja/translation.json @@ -34,6 +34,25 @@ "chat": { "defaultChatTitle": "会話" - } + }, + + "profile": { + "settingsTitle": "ユーザー設定", + "logout": "ログアウト", + "profileTab": "プロフィール", + "apiKeysTab": "APIキー", + "usernameLabel": "ユーザー名", + "usernamePlaceholder": "ユーザー名を入力してください", + "available": "利用可能", + "unavailable": "利用不可", + "usernameError": "ユーザー名は文字、数字、またはアンダースコアのみで、その他の文字やスペースは使用できません。", + "chatDisplayName": "チャット表示名", + "chatDisplayNamePlaceholder": "あなたの名前", + "instructionsLabel": "AIにあなたに関するどのような情報を知ってもらいたいですか?", + "instructionsPlaceholder": "プロフィールの説明...(オプション)", + "profileImageLabel": "プロフィール画像", + "cancel": "キャンセル", + "save": "保存" + } } \ No newline at end of file diff --git a/public/locales/zh/translation.json b/public/locales/zh/translation.json index 3a5a07f..54aa024 100644 --- a/public/locales/zh/translation.json +++ b/public/locales/zh/translation.json @@ -34,5 +34,24 @@ "chat": { "defaultChatTitle": "对话" + }, + + "profile": { + "settingsTitle": "用户设置", + "logout": "注销", + "profileTab": "个人资料", + "apiKeysTab": "API 密钥", + "usernameLabel": "用户名", + "usernamePlaceholder": "请输入用户名", + "available": "可用", + "unavailable": "不可用", + "usernameError": "用户名只能包含字母、数字或下划线,不能包含其他字符或空格。", + "chatDisplayName": "聊天显示名称", + "chatDisplayNamePlaceholder": "您的名称", + "instructionsLabel": "你希望 AI 知道关于你的哪些信息以便提供更好的回答?", + "instructionsPlaceholder": "个人资料描述...(可选)", + "profileImageLabel": "个人资料图片", + "cancel": "取消", + "save": "保存" } }