From f533724db5d0bdc82d402005f01d8743db71fe37 Mon Sep 17 00:00:00 2001 From: hailin Date: Fri, 18 Apr 2025 09:21:20 +0800 Subject: [PATCH] . --- app/[locale]/setup/page.tsx | 12 ++++++------ components/ui/language-switcher.tsx | 6 ++++++ public/locales/en/translation.json | 15 +++++++++------ public/locales/ja/translation.json | 14 ++++++++------ public/locales/zh/translation.json | 16 +++++++++------- 5 files changed, 38 insertions(+), 25 deletions(-) diff --git a/app/[locale]/setup/page.tsx b/app/[locale]/setup/page.tsx index e8811dd..94d7fa1 100644 --- a/app/[locale]/setup/page.tsx +++ b/app/[locale]/setup/page.tsx @@ -164,9 +164,9 @@ export default function SetupPage() { case 1: return ( { @@ -45,6 +47,10 @@ export function LanguageSwitcher() { const cookieValue = document.cookie console.log('[LanguageSwitcher] Check writed Cookie value:', cookieValue) + + // 更新 i18n 的语言 + i18n.changeLanguage(newLocale) // 修改 TranslationProvider 中的 locale + let segments = pathname === '/' ? [] : pathname.split('/').filter(Boolean) const isLocaleInPath = i18nConfig.locales.includes(segments[0] as any) diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index a2665ad..a1ee78a 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -2,12 +2,15 @@ "Ask anything. Type \"/\" for prompts, \"@\" for files, and \"#\" for tools.": "Ask anything. Type \"/\" for prompts, \"@\" for files, and \"#\" for tools.", "Company Name": "Jelly Drops LLC", "Clock In": "Clock In", - "Let's create your profile.": "Let's create your profile.", - "Welcome to Chatbot UI": "Welcome to Chatbot UI", - "Enter API keys for each service you'd like to use.": "Enter API keys for each service you'd like to use.", - "Set API Keys (optional)": "Set API Keys (optional)", - "You are all set up!": "You are all set up!", - "Setup Complete": "Setup Complete", + + "setup": { + "LetsCreateYourProfile": "Let's create your profile.", + "WelcomeToChatbotUI": "Welcome to Chatbot UI", + "EnterAPIKeysForEachServiceYoudLikeToUse": "Enter API keys for each service you'd like to use.", + "SetAPIKeysOptional": "Set API Keys (optional)", + "YouAreAllSetUp": "You are all set up!", + "SetupComplete": "Setup Complete" + }, "login": { "email": "Email", diff --git a/public/locales/ja/translation.json b/public/locales/ja/translation.json index 03e0154..1af1f02 100644 --- a/public/locales/ja/translation.json +++ b/public/locales/ja/translation.json @@ -2,11 +2,13 @@ "Ask anything. Type \"/\" for prompts, \"@\" for files, and \"#\" for tools.": "何でも聞いてください。「/」でプロンプト、「@」でファイル、「#」でツールを入力してください。", "Company Name": "Jelly Drops LLC", "Clock In": "出勤する", - "Let's create your profile.": "プロフィールを作成しましょう。", - "Welcome to Chatbot UI": "Chatbot UIへようこそ", - "Enter API keys for each service you'd like to use.": "使用する各サービスのAPIキーを入力してください。", - "Set API Keys (optional)": "APIキーの設定(オプション)", - "You are all set up!": "設定が完了しました!", - "Setup Complete": "セットアップ完了" + "setup": { + "LetsCreateYourProfile": "プロフィールを作成しましょう。", + "WelcomeToChatbotUI": "Chatbot UIへようこそ", + "EnterAPIKeysForEachServiceYoudLikeToUse": "使用する各サービスのAPIキーを入力してください。", + "SetAPIKeysOptional": "APIキーの設定(オプション)", + "YouAreAllSetUp": "設定が完了しました!", + "SetupComplete": "セットアップ完了" + } } \ No newline at end of file diff --git a/public/locales/zh/translation.json b/public/locales/zh/translation.json index 44166c9..bc2e345 100644 --- a/public/locales/zh/translation.json +++ b/public/locales/zh/translation.json @@ -2,13 +2,15 @@ "Ask anything. Type \"/\" for prompts, \"@\" for files, and \"#\" for tools.": "随便问点什么。输入“/”查找提示,“@”查找文件,“#”查找工具。", "Company Name": "深圳果冻移民咨询有限责任公司", "Clock In": "打卡", - "Let's create your profile.": "让我们来创建您的个人资料。", - "Welcome to Chatbot UI": "欢迎使用 Chatbot UI", - "Enter API keys for each service you'd like to use.": "输入您希望使用的每个服务的 API 密钥。", - "Set API Keys (optional)": "设置 API 密钥(可选)", - "You are all set up!": "设置完成!", - "Setup Complete": "设置完成", - + "setup": { + "LetsCreateYourProfile": "让我们来创建您的个人资料。", + "WelcomeToChatbotUI": "欢迎使用 Chatbot UI", + "EnterAPIKeysForEachServiceYoudLikeToUse": "输入您希望使用的每个服务的 API 密钥。", + "SetAPIKeysOptional": "设置 API 密钥(可选)", + "YouAreAllSetUp": "设置完成!", + "SetupComplete": "设置完成" + }, + "login": { "email": "电子邮件", "emailPlaceholder": "you@example.com",