diff --git a/frontend/src/i18n/locales/en.json b/frontend/src/i18n/locales/en.json index a22313f..3698b5b 100644 --- a/frontend/src/i18n/locales/en.json +++ b/frontend/src/i18n/locales/en.json @@ -219,5 +219,19 @@ "dashboards": "Dashboards", "new": "New", "pinChartToDashboard": "Pin chart to dashboard", - "selectDashboardToPin": "Select a dashboard to pin this chart to." + "selectDashboardToPin": "Select a dashboard to pin this chart to.", + "welcomeBack": "Welcome Back", + "createAccount": "Create Account", + "username": "Username", + "enterUsername": "Enter your username", + "email": "Email", + "enterEmail": "Enter your email", + "password": "Password", + "enterPassword": "Enter your password", + "signIn": "Sign In", + "signUp": "Sign Up", + "dontHaveAccount": "Don't have an account?", + "alreadyHaveAccount": "Already have an account?", + "registrationSuccess": "Registration successful! Please login.", + "errorOccurred": "An error occurred" } diff --git a/frontend/src/i18n/locales/zh.json b/frontend/src/i18n/locales/zh.json index cbe97ff..9627084 100644 --- a/frontend/src/i18n/locales/zh.json +++ b/frontend/src/i18n/locales/zh.json @@ -219,5 +219,19 @@ "threads": "会话", "archivedThreads": "已归档会话", "defaultUser": "默认用户", - "searchSkills": "搜索技能..." + "searchSkills": "搜索技能...", + "welcomeBack": "欢迎回来", + "createAccount": "创建账号", + "username": "用户名", + "enterUsername": "请输入您的用户名", + "email": "邮箱", + "enterEmail": "请输入您的邮箱", + "password": "密码", + "enterPassword": "请输入您的密码", + "signIn": "登录", + "signUp": "注册", + "dontHaveAccount": "还没有账号?", + "alreadyHaveAccount": "已经有账号了?", + "registrationSuccess": "注册成功!请登录。", + "errorOccurred": "发生了一个错误" } diff --git a/frontend/src/pages/Login.tsx b/frontend/src/pages/Login.tsx index 0d822a7..02c757b 100644 --- a/frontend/src/pages/Login.tsx +++ b/frontend/src/pages/Login.tsx @@ -1,13 +1,21 @@ import { useState } from "react"; import { useNavigate } from "react-router-dom"; +import { useTranslation } from "react-i18next"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; -import { Loader2 } from "lucide-react"; +import { Loader2, Languages } from "lucide-react"; import { api } from "@/lib/api"; import { useAuthStore } from "@/store/authStore"; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu"; export function Login() { + const { t, i18n } = useTranslation(); const [isLogin, setIsLogin] = useState(true); const [isLoading, setIsLoading] = useState(false); const [error, setError] = useState(""); @@ -58,10 +66,10 @@ export function Login() { // Auto login after successful registration setIsLogin(true); - setError("Registration successful! Please login."); + setError(t("registrationSuccess")); } } catch (err: any) { - setError(err.message || "An error occurred"); + setError(err.message || t("errorOccurred")); } finally { setIsLoading(false); } @@ -70,33 +78,50 @@ export function Login() { return (