refactor: 完成全站国际化改造,统一多语言支持

此提交完成了全项目的国际化适配:
1. 新增多语言翻译文件与基础配置
2. 替换所有硬编码文本为i18n调用
3. 优化语言切换与文档语言同步逻辑
4. 重构部分业务逻辑以支持动态翻译
5. 移除过时代码与硬编码配置
This commit is contained in:
2026-05-15 10:41:14 +08:00
parent ac612cb32c
commit f2c7f5e4f1
53 changed files with 2179 additions and 767 deletions

View File

@@ -2,6 +2,7 @@
import { ArrowDownLeft, ArrowUpRight } from "lucide-react";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { Button } from "@/components/ui/button";
import {
@@ -42,7 +43,7 @@ export function TransferInDialog({
idPrefix = "",
triggerClassName,
triggerVariant = "wallet",
triggerLabel = "转入",
triggerLabel,
}: BaseProps & {
lotteryMinor: number;
triggerClassName?: string;
@@ -50,6 +51,8 @@ export function TransferInDialog({
triggerLabel?: string;
}) {
const [open, setOpen] = useState(false);
const { t } = useTranslation("player");
const resolvedTriggerLabel = triggerLabel ?? t("wallet.transferIn");
const triggerCombined = cn(
"inline-flex h-10 min-h-10 w-full min-w-0 flex-1 items-center justify-center gap-1.5 px-3 text-sm font-medium",
@@ -66,14 +69,13 @@ export function TransferInDialog({
onClick={() => setOpen(true)}
>
<ArrowDownLeft className="size-4 shrink-0" />
{triggerLabel}
{resolvedTriggerLabel}
</Button>
<DialogContent showCloseButton>
<DialogHeader>
<DialogTitle></DialogTitle>
<DialogTitle>{t("wallet.transferInTitle")}</DialogTitle>
<DialogDescription>
1.00{" "}
{currency}
{t("wallet.dialogInDescription", { currency })}
</DialogDescription>
</DialogHeader>
<TransferInPanel
@@ -99,7 +101,7 @@ export function TransferOutDialog({
idPrefix = "",
triggerClassName,
triggerVariant = "wallet",
triggerLabel = "转出",
triggerLabel,
}: BaseProps & {
availableMinor: number;
triggerClassName?: string;
@@ -107,6 +109,8 @@ export function TransferOutDialog({
triggerLabel?: string;
}) {
const [open, setOpen] = useState(false);
const { t } = useTranslation("player");
const resolvedTriggerLabel = triggerLabel ?? t("wallet.transferOut");
const triggerCombined = cn(
"inline-flex h-10 min-h-10 w-full min-w-0 flex-1 items-center justify-center gap-1.5 px-3 text-sm font-medium",
@@ -128,13 +132,13 @@ export function TransferOutDialog({
onClick={() => setOpen(true)}
>
<ArrowUpRight className="size-4 shrink-0" />
{triggerLabel}
{resolvedTriggerLabel}
</Button>
<DialogContent showCloseButton>
<DialogHeader>
<DialogTitle></DialogTitle>
<DialogTitle>{t("wallet.transferOutTitle")}</DialogTitle>
<DialogDescription>
{t("wallet.dialogOutDescription")}
</DialogDescription>
</DialogHeader>
<TransferOutPanel