This commit is contained in:
hailin 2025-04-18 09:21:20 +08:00
parent d0c310aba8
commit f533724db5
5 changed files with 38 additions and 25 deletions

View File

@ -164,9 +164,9 @@ export default function SetupPage() {
case 1: case 1:
return ( return (
<StepContainer <StepContainer
stepDescription={t("Let's create your profile.")} stepDescription={t("setup.LetsCreateYourProfile")}
stepNum={currentStep} stepNum={currentStep}
stepTitle={t("Welcome to Chatbot UI")} stepTitle={t("setup.WelcomeToChatbotUI")}
onShouldProceed={handleShouldProceed} onShouldProceed={handleShouldProceed}
showNextButton={!!(username && usernameAvailable)} showNextButton={!!(username && usernameAvailable)}
showBackButton={false} showBackButton={false}
@ -186,9 +186,9 @@ export default function SetupPage() {
case 2: case 2:
return ( return (
<StepContainer <StepContainer
stepDescription={t("Enter API keys for each service you'd like to use.")} stepDescription={t("setup.EnterAPIKeysForEachServiceYoudLikeToUse")}
stepNum={currentStep} stepNum={currentStep}
stepTitle={t("Set API Keys (optional)")} stepTitle={t("SetAPIKeysOptional")}
onShouldProceed={handleShouldProceed} onShouldProceed={handleShouldProceed}
showNextButton={true} showNextButton={true}
showBackButton={true} showBackButton={true}
@ -232,9 +232,9 @@ export default function SetupPage() {
case 3: case 3:
return ( return (
<StepContainer <StepContainer
stepDescription={t("You are all set up!")} stepDescription={t("setup.YouAreAllSetUp")}
stepNum={currentStep} stepNum={currentStep}
stepTitle={t("Setup Complete")} stepTitle={t("setup.SetupComplete")}
onShouldProceed={handleShouldProceed} onShouldProceed={handleShouldProceed}
showNextButton={true} showNextButton={true}
showBackButton={true} showBackButton={true}

View File

@ -4,12 +4,14 @@ import i18nConfig from '@/i18nConfig'
import { usePathname, useRouter } from 'next/navigation' import { usePathname, useRouter } from 'next/navigation'
import { useEffect, useTransition } from 'react' import { useEffect, useTransition } from 'react'
import { Globe } from 'lucide-react' import { Globe } from 'lucide-react'
import { useTranslation } from 'react-i18next'
export function LanguageSwitcher() { export function LanguageSwitcher() {
const router = useRouter() const router = useRouter()
const pathname = usePathname() const pathname = usePathname()
const [isPending, startTransition] = useTransition() const [isPending, startTransition] = useTransition()
const { i18n } = useTranslation() // 获取 i18n 实例
const currentLocale = pathname.split('/')[1] || i18nConfig.defaultLocale const currentLocale = pathname.split('/')[1] || i18nConfig.defaultLocale
useEffect(() => { useEffect(() => {
@ -45,6 +47,10 @@ export function LanguageSwitcher() {
const cookieValue = document.cookie const cookieValue = document.cookie
console.log('[LanguageSwitcher] Check writed Cookie value:', cookieValue) console.log('[LanguageSwitcher] Check writed Cookie value:', cookieValue)
// 更新 i18n 的语言
i18n.changeLanguage(newLocale) // 修改 TranslationProvider 中的 locale
let segments = pathname === '/' ? [] : pathname.split('/').filter(Boolean) let segments = pathname === '/' ? [] : pathname.split('/').filter(Boolean)
const isLocaleInPath = i18nConfig.locales.includes(segments[0] as any) const isLocaleInPath = i18nConfig.locales.includes(segments[0] as any)

View File

@ -2,12 +2,15 @@
"Ask anything. Type \"/\" for prompts, \"@\" for files, and \"#\" for tools.": "Ask anything. Type \"/\" for prompts, \"@\" for files, and \"#\" for tools.", "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", "Company Name": "Jelly Drops LLC",
"Clock In": "Clock In", "Clock In": "Clock In",
"Let's create your profile.": "Let's create your profile.",
"Welcome to Chatbot UI": "Welcome to Chatbot UI", "setup": {
"Enter API keys for each service you'd like to use.": "Enter API keys for each service you'd like to use.", "LetsCreateYourProfile": "Let's create your profile.",
"Set API Keys (optional)": "Set API Keys (optional)", "WelcomeToChatbotUI": "Welcome to Chatbot UI",
"You are all set up!": "You are all set up!", "EnterAPIKeysForEachServiceYoudLikeToUse": "Enter API keys for each service you'd like to use.",
"Setup Complete": "Setup Complete", "SetAPIKeysOptional": "Set API Keys (optional)",
"YouAreAllSetUp": "You are all set up!",
"SetupComplete": "Setup Complete"
},
"login": { "login": {
"email": "Email", "email": "Email",

View File

@ -2,11 +2,13 @@
"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", "Company Name": "Jelly Drops LLC",
"Clock In": "出勤する", "Clock In": "出勤する",
"Let's create your profile.": "プロフィールを作成しましょう。", "setup": {
"Welcome to Chatbot UI": "Chatbot UIへようこそ", "LetsCreateYourProfile": "プロフィールを作成しましょう。",
"Enter API keys for each service you'd like to use.": "使用する各サービスのAPIキーを入力してください。", "WelcomeToChatbotUI": "Chatbot UIへようこそ",
"Set API Keys (optional)": "APIキーの設定オプション", "EnterAPIKeysForEachServiceYoudLikeToUse": "使用する各サービスのAPIキーを入力してください。",
"You are all set up!": "設定が完了しました!", "SetAPIKeysOptional": "APIキーの設定オプション",
"Setup Complete": "セットアップ完了" "YouAreAllSetUp": "設定が完了しました!",
"SetupComplete": "セットアップ完了"
}
} }

View File

@ -2,13 +2,15 @@
"Ask anything. Type \"/\" for prompts, \"@\" for files, and \"#\" for tools.": "随便问点什么。输入“/”查找提示,“@”查找文件,“#”查找工具。", "Ask anything. Type \"/\" for prompts, \"@\" for files, and \"#\" for tools.": "随便问点什么。输入“/”查找提示,“@”查找文件,“#”查找工具。",
"Company Name": "深圳果冻移民咨询有限责任公司", "Company Name": "深圳果冻移民咨询有限责任公司",
"Clock In": "打卡", "Clock In": "打卡",
"Let's create your profile.": "让我们来创建您的个人资料。", "setup": {
"Welcome to Chatbot UI": "欢迎使用 Chatbot UI", "LetsCreateYourProfile": "让我们来创建您的个人资料。",
"Enter API keys for each service you'd like to use.": "输入您希望使用的每个服务的 API 密钥。", "WelcomeToChatbotUI": "欢迎使用 Chatbot UI",
"Set API Keys (optional)": "设置 API 密钥(可选)", "EnterAPIKeysForEachServiceYoudLikeToUse": "输入您希望使用的每个服务的 API 密钥。",
"You are all set up!": "设置完成!", "SetAPIKeysOptional": "设置 API 密钥(可选)",
"Setup Complete": "设置完成", "YouAreAllSetUp": "设置完成!",
"SetupComplete": "设置完成"
},
"login": { "login": {
"email": "电子邮件", "email": "电子邮件",
"emailPlaceholder": "you@example.com", "emailPlaceholder": "you@example.com",