-
+
setCode(e.target.value)}
/>
@@ -80,7 +84,7 @@ export default function RechargeBalance({ userId }: { userId: string }) {
loading={rechargeBalanceByCodeMutation.isLoading}
success={rechargeBalanceByCodeMutation.isSuccess}
>
- 充值
+ {t("recharge")}
diff --git a/src/app/[local]/(manage)/user/[userId]/_components/recharge-depay.tsx b/src/app/[local]/(manage)/user/[userId]/_components/recharge-depay.tsx
index abd192f..bb9af5c 100644
--- a/src/app/[local]/(manage)/user/[userId]/_components/recharge-depay.tsx
+++ b/src/app/[local]/(manage)/user/[userId]/_components/recharge-depay.tsx
@@ -11,6 +11,7 @@ import { type RouterOutputs } from "~/trpc/shared";
import Image from "next/image";
import Blockchains from "@depay/web3-blockchains";
import { useTrack } from "~/lib/hooks/use-track";
+import { useTranslations } from "use-intl";
const dePayWidgetStyles = `
.PoweredByWrapper {
@@ -39,6 +40,7 @@ const dePayWidgetStyles = `
`;
export default function RechargeDepay() {
+ const t = useTranslations("user-[userId]-recharge-depay");
const dePayRef = useRef(null);
const [amount, setAmount] = useState("0");
const [dePay, setDePay] = useState<{
@@ -78,15 +80,15 @@ export default function RechargeDepay() {
amount: data.amount,
});
toast({
- title: "充值成功",
- description: `充值金额 ${data.amount} USDC/USDT`,
+ title: t("recharge_successful"),
+ description: `${t("recharge_amount")} ${data.amount} USDC/USDT`,
});
} else if (data?.status === "FAILED") {
track("recharge-depay-fail", {
amount: data.amount,
});
toast({
- title: "充值失败",
+ title: t("recharge_failed"),
variant: "destructive",
});
}
@@ -118,7 +120,7 @@ export default function RechargeDepay() {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const configuration: DePayWidgets.PaymentOptions = {
- title: "充值",
+ title: t("recharge"),
container: dePayRef.current,
integration: dePayIntegrationId,
payload: payload,
@@ -165,8 +167,8 @@ export default function RechargeDepay() {
const amountNumber = parseFloat(amount);
if (isNaN(amountNumber) || amountNumber < rechargeMinAmount) {
toast({
- title: "无效的金额",
- description: `充值金额最低 ${rechargeMinAmount} USDC/USDT`,
+ title: t("invalid_amount"),
+ description: `${t("recharge_amount")} ${rechargeMinAmount} USDC/USDT`,
variant: "destructive",
});
return;
@@ -191,7 +193,7 @@ export default function RechargeDepay() {
{!dePay.loaded && (
<>
-
+
{
@@ -201,21 +203,22 @@ export default function RechargeDepay() {
-
注意事项
+
{t("notes")}
- 1. 支持 USDC 和 USDT 充值,充值金额最低 $
- {rechargeMinAmount}。
+ 1.{" "}
+ {t.rich("note_1", {
+ important: (children) => {children},
+ rechargeMinAmount: rechargeMinAmount,
+ })}
-
- 2. 点击确认后,将会进入加密钱包选择支付方式。
-
-
3. 充值需要收取 1.5% 的手续费。
+
2. {t("note_2")}
+
3. {t("note_3")}
-
支持的网络
+
{t("supported_networks")}
{[
Blockchains.avalanche,
diff --git a/src/app/[local]/(manage)/user/[userId]/_components/update-balance.tsx b/src/app/[local]/(manage)/user/[userId]/_components/update-balance.tsx
index 64ca3bf..ee64e4a 100644
--- a/src/app/[local]/(manage)/user/[userId]/_components/update-balance.tsx
+++ b/src/app/[local]/(manage)/user/[userId]/_components/update-balance.tsx
@@ -29,6 +29,7 @@ import { Label } from "~/lib/ui/label";
import { MoneyInput } from "~/lib/ui/money-input";
import { type BalanceType } from "@prisma/client";
import { useTrack } from "~/lib/hooks/use-track";
+import { useTranslations } from "use-intl";
export const updateBalanceFormSchema = z.object({
amount: z.preprocess(
@@ -45,6 +46,7 @@ export default function UpdateBalance({
userId: string;
balanceType?: BalanceType;
}) {
+ const t = useTranslations("user-[userId]-update-balance");
const [deduct, setDeduct] = useState(false);
const { track } = useTrack();
const updateBalanceMutation = api.user.updateBalance.useMutation({});
@@ -74,13 +76,13 @@ export default function UpdateBalance({
- 更新余额
- 为用户添加或减少余额
+ {t("update_balance")}
+ {t("add_or_subtract_balance")}
-
+
diff --git a/src/app/[local]/(manage)/user/[userId]/_components/withdrawal-balance.tsx b/src/app/[local]/(manage)/user/[userId]/_components/withdrawal-balance.tsx
index 8e495c3..974d845 100644
--- a/src/app/[local]/(manage)/user/[userId]/_components/withdrawal-balance.tsx
+++ b/src/app/[local]/(manage)/user/[userId]/_components/withdrawal-balance.tsx
@@ -26,6 +26,7 @@ import { api } from "~/trpc/react";
import { useForm } from "react-hook-form";
import { useMemo } from "react";
import { useTrack } from "~/lib/hooks/use-track";
+import { useTranslations } from "use-intl";
export const withdrawalBalanceFormSchema = z.object({
amount: z.preprocess(
@@ -36,6 +37,7 @@ export const withdrawalBalanceFormSchema = z.object({
});
export default function WithdrawalBalance({ balance }: { balance: string }) {
+ const t = useTranslations("user-[userId]-withdrawal-balance");
const createWithdrawalMutation = api.withdrawal.create.useMutation({});
const { data: config } = api.system.getConfig.useQuery({
key: "WITHDRAW_MIN_AMOUNT",
@@ -64,15 +66,17 @@ export default function WithdrawalBalance({ balance }: { balance: string }) {
- 提现
+ {t("withdrawal")}
- 申请提现到指定的地址,需要扣除部分手续费,以实际到账金额为准
- 当前收益余额:${balance}
+ {t("request_withdrawal_desc")}
+
+ {t("current_earnings_balance")}:${balance}
+
diff --git a/src/app/[local]/(manage)/user/[userId]/account/page.tsx b/src/app/[local]/(manage)/user/[userId]/account/page.tsx
index 3bf0369..4898e3a 100644
--- a/src/app/[local]/(manage)/user/[userId]/account/page.tsx
+++ b/src/app/[local]/(manage)/user/[userId]/account/page.tsx
@@ -1,32 +1,36 @@
-import { Separator } from "../../../../../../lib/ui/separator";
+import { Separator } from "~/lib/ui/separator";
import { api } from "~/trpc/server";
import { Label } from "~/lib/ui/label";
import UpdatePasswordDialog from "~/app/[local]/_components/update-password-dialog";
+import { getTranslations } from "next-intl/server";
export default async function UserAccountPage({
params: { userId },
}: {
params: { userId: string };
}) {
+ const t = await getTranslations("user-[userId]-account");
const user = await api.user.getOne.query({ id: userId });
return (
-
账号
-
查看和更新你的账号信息
+
{t("account")}
+
+ {t("view_update_account_info")}
+
-
+
{user.email}
-
+
- {user.isSetupPassword ? "********" : "未设置密码"}
+ {user.isSetupPassword ? "********" : t("password_not_set")}
-
余额
-
查看你的账户余额
+
{t("balance")}
+
+ {t("check_your_account_balance")}
+
- 余额
+ {t("balance")}
{session?.user.roles.includes(Role.AGENT_PROVIDER) && (
- 收益
+ {t("earnings")}
)}
diff --git a/src/app/[local]/(manage)/user/[userId]/layout.tsx b/src/app/[local]/(manage)/user/[userId]/layout.tsx
index 2c90c63..73db100 100644
--- a/src/app/[local]/(manage)/user/[userId]/layout.tsx
+++ b/src/app/[local]/(manage)/user/[userId]/layout.tsx
@@ -2,30 +2,32 @@ import { Separator } from "~/lib/ui/separator";
import { type ReactNode } from "react";
import { SidebarNav } from "~/app/[local]/_components/sidebar-nav";
import type { Metadata } from "next";
+import { getTranslations } from "next-intl/server";
export const metadata: Metadata = {
title: "用户中心 - vortex",
description: "用户中心",
};
-export default function UserLayout({
+export default async function UserLayout({
children,
params: { userId },
}: {
children: ReactNode;
params: { userId: string };
}) {
+ const t = await getTranslations("user-[userId]-layout");
const sidebarNavItems = [
{
- title: "个人资料",
+ title: t("profile"),
href: `/user/${userId}`,
},
{
- title: "账户",
+ title: t("account"),
href: `/user/${userId}/account`,
},
{
- title: "余额",
+ title: t("balance"),
href: `/user/${userId}/balance`,
},
];
@@ -33,9 +35,11 @@ export default function UserLayout({
return (
-
个人中心
+
+ {t("user_center")}
+
- 管理您的帐户设置并设置电子邮件首选项。
+ {t("manage_account_settings_email_preferences")}
diff --git a/src/app/[local]/(manage)/user/[userId]/page.tsx b/src/app/[local]/(manage)/user/[userId]/page.tsx
index ccded3b..d3a92f4 100644
--- a/src/app/[local]/(manage)/user/[userId]/page.tsx
+++ b/src/app/[local]/(manage)/user/[userId]/page.tsx
@@ -1,6 +1,7 @@
import { Separator } from "~/lib/ui/separator";
import ProfileForm from "~/app/[local]/(manage)/user/[userId]/_components/profile-form";
import { api } from "~/trpc/server";
+import { getTranslations } from "next-intl/server";
export default async function SettingProfilePage({
params: { userId },
@@ -8,14 +9,13 @@ export default async function SettingProfilePage({
params: { userId: string };
}) {
const user = await api.user.getOne.query({ id: userId });
+ const t = await getTranslations("user-[userId]");
return (
-
个人资料
-
- 设置你的名称和头像,需要重新登录后生效
-
+
{t("profile")}
+
{t("set_name_avatar")}
diff --git a/src/app/[local]/_components/update-password-dialog.tsx b/src/app/[local]/_components/update-password-dialog.tsx
index 2c188d1..5ebc232 100644
--- a/src/app/[local]/_components/update-password-dialog.tsx
+++ b/src/app/[local]/_components/update-password-dialog.tsx
@@ -7,22 +7,26 @@ import {
} from "~/lib/ui/dialog";
import UpdatePasswordForm from "~/app/[local]/_components/update-password-form";
import { Button } from "~/lib/ui/button";
+import { getTranslations } from "next-intl/server";
-export default function UpdatePasswordDialog({
+export default async function UpdatePasswordDialog({
userId,
type,
}: {
userId: string;
type: "setup" | "reset";
}) {
+ const t = await getTranslations("global_update-password-dialog");
return (