From bf6dff352ebc98805a62a393dcd869d41020fff9 Mon Sep 17 00:00:00 2001 From: TQY <17823167416@163.com> Date: Fri, 17 Oct 2025 10:43:04 +0800 Subject: [PATCH] chinese --- frontend/src/pages/Bookmark.jsx | 12 +++++----- frontend/src/pages/CreatePollForm.jsx | 32 +++++++++++++-------------- frontend/src/pages/Dashboard.jsx | 18 +++++++-------- frontend/src/pages/Polls.jsx | 6 ++--- frontend/src/pages/Register.jsx | 24 ++++++++++---------- frontend/src/pages/VotingPage.jsx | 10 ++++----- 6 files changed, 51 insertions(+), 51 deletions(-) diff --git a/frontend/src/pages/Bookmark.jsx b/frontend/src/pages/Bookmark.jsx index c94cae7..40c00f9 100644 --- a/frontend/src/pages/Bookmark.jsx +++ b/frontend/src/pages/Bookmark.jsx @@ -40,7 +40,7 @@ function Bookmark() { return (

- Bookmarked Polls + 收藏的投票

{isError && (
@@ -54,9 +54,9 @@ function Bookmark() { # - Title - Description - Actions + 标题 + 描述 + 操作 @@ -74,13 +74,13 @@ function Bookmark() { onClick={() => handleViewPollClick(bookmark._id)} className="btn btn-sm btn-primary text-sm md:text-base mb-2 md:mb-1" > - View Poll + 查看投票 diff --git a/frontend/src/pages/CreatePollForm.jsx b/frontend/src/pages/CreatePollForm.jsx index bddec0f..ba4925f 100644 --- a/frontend/src/pages/CreatePollForm.jsx +++ b/frontend/src/pages/CreatePollForm.jsx @@ -30,7 +30,7 @@ function CreatePollForm() { const mutation = useMutation(createPollService, { onSuccess: (data) => { - const message = data?.message || "Poll created successfully"; + const message = data?.message || "投票创建成功"; toast.success(message); handleClearPoll(); navigate(`/view/${data?.data?._id}`); @@ -39,7 +39,7 @@ function CreatePollForm() { console.log(error); const errorMessage = error.response?.data?.errors?.[0]?.message || - "An unexpected error occurred"; + "发生意外错误"; toast.error(errorMessage); }, }); @@ -47,7 +47,7 @@ function CreatePollForm() { const handlePollSubmit = (e) => { e.preventDefault(); if (title.trim() == "" || description.trim() == "" || options.length == 0) { - toast.error("All fields are required"); + toast.error("所有字段都是必填的"); return; } mutation.mutate({ title, description, options }); @@ -56,19 +56,19 @@ function CreatePollForm() { return (
-

Create New Poll

+

创建新投票

{/* Poll Title */}
setTitle(e.target.value)} - placeholder="Enter poll title" + placeholder="输入投票标题" className="input input-bordered w-full" />
@@ -76,12 +76,12 @@ function CreatePollForm() { {/* Poll Description */}
@@ -91,21 +91,21 @@ function CreatePollForm() {
{/* Poll Options */}
- + {options.map((option, index) => (
{options.length > 2 && (
@@ -131,7 +131,7 @@ function CreatePollForm() { title="Add another option" onClick={handleAddOption} > - Add Option + 添加选项
@@ -142,21 +142,21 @@ function CreatePollForm() { className="btn btn-ghost w-full mt-4 md:w-1/2" onClick={() => { const sure = window.confirm( - "Are you sure you want to clear the poll?" + "确定要清除投票内容吗?" ); if (sure) { handleClearPoll(); } }} > - Clear Poll + 清除投票 {/* Submit Button */}
diff --git a/frontend/src/pages/Dashboard.jsx b/frontend/src/pages/Dashboard.jsx index 371d7cd..f58d117 100644 --- a/frontend/src/pages/Dashboard.jsx +++ b/frontend/src/pages/Dashboard.jsx @@ -60,12 +60,12 @@ function Dashboard() {

{user?.email || "Email"}

- + @@ -74,10 +74,10 @@ function Dashboard() { {/* Dashboard Header */}

- Poll Dashboard + 投票仪表板

- Manage your polls, view results, and edit as needed. + 管理您的投票,查看结果,并根据需要进行编辑。

@@ -87,7 +87,7 @@ function Dashboard() { className="btn btn-primary" onClick={() => navigator("/create")} > - Add New Poll + 添加新投票
@@ -100,10 +100,10 @@ function Dashboard() { # - Title - Description - Published - Actions + 标题 + 描述 + 已发布 + 操作 diff --git a/frontend/src/pages/Polls.jsx b/frontend/src/pages/Polls.jsx index fbf9f96..0b0c746 100644 --- a/frontend/src/pages/Polls.jsx +++ b/frontend/src/pages/Polls.jsx @@ -19,7 +19,7 @@ function Polls() { return (
-

Polls

+

投票列表

{isSuccess && (
{data?.data?.polls?.map((poll) => ( @@ -42,14 +42,14 @@ function Polls() { disabled={page <= 1} onClick={() => setPage(page - 1)} > - Prev + 上一页
diff --git a/frontend/src/pages/Register.jsx b/frontend/src/pages/Register.jsx index 79ea0b8..9f945c3 100644 --- a/frontend/src/pages/Register.jsx +++ b/frontend/src/pages/Register.jsx @@ -38,20 +38,20 @@ function Register() {

- Sign Up + 注册

{/* Username Input */}
setUsername(e.target.value)} type="text" - placeholder="Enter your username" + placeholder="请输入您的用户名" className="input input-bordered w-full bg-gray-700 text-white focus:outline-none focus:ring focus:ring-primary" required /> @@ -60,13 +60,13 @@ function Register() { {/* Email Input */}
setEmail(e.target.value)} - placeholder="Enter your email" + placeholder="请输入您的邮箱" className="input input-bordered w-full bg-gray-700 text-white focus:outline-none focus:ring focus:ring-primary" required /> @@ -75,13 +75,13 @@ function Register() { {/* Password Input */}
setPassword(e.target.value)} - placeholder="Enter your password" + placeholder="请输入您的密码" className="input input-bordered w-full bg-gray-700 text-white focus:outline-none focus:ring focus:ring-primary" required /> @@ -91,7 +91,7 @@ function Register() { {mutation.isError && } {mutation.isSuccess && (

- 🎉 {mutation.data.message || "Process is successfull"} + 🎉 {mutation.data.message || "注册成功"}

)} @@ -102,19 +102,19 @@ function Register() { type="submit" className="btn btn-primary w-full text-white mt-4" > - {mutation.isLoading ? : "Sign Up"} + {mutation.isLoading ? : "注册"}
{/* Divider */} -
OR
+
{/* Login Link */}

- Already have an account?{" "} + 已有账户?{" "} - Login + 登录

diff --git a/frontend/src/pages/VotingPage.jsx b/frontend/src/pages/VotingPage.jsx index d58430d..bde6be3 100644 --- a/frontend/src/pages/VotingPage.jsx +++ b/frontend/src/pages/VotingPage.jsx @@ -87,7 +87,7 @@ function VotingPage() { const mutation = useMutation(createVoteService, { onSuccess: (data) => { - toast.success("Vote submitted successfully"); + toast.success("投票提交成功"); if (socket) { socket.emit("vote", { pollId, success: data?.success }); } @@ -95,7 +95,7 @@ function VotingPage() { onError: (error) => { console.error(error); toast.error( - error?.response?.data?.message || "An unexpected error occurred" + error?.response?.data?.message || "发生意外错误" ); }, }); @@ -133,7 +133,7 @@ function VotingPage() { className="rounded-full h-7 md:h-10 w-7 md:w-10" />

- {poll?.data?.creatorData?.username || "Unknown"} + {poll?.data?.creatorData?.username || "未知"}

@@ -145,12 +145,12 @@ function VotingPage() { {/* Poll Title */}

- {poll?.data?.pollData?.title || "Loading.."} + {poll?.data?.pollData?.title || "加载中.."}

{/* Poll Description */}

- {poll?.data?.pollData?.description || "Loading.."} + {poll?.data?.pollData?.description || "加载中.."}

{/* Voting Options */}