feat: 增加管理端多语言与多模块界面国际化支持

This commit is contained in:
2026-05-19 09:11:55 +08:00
parent 49a4caf01e
commit 1b1dfc92ab
110 changed files with 4053 additions and 1308 deletions

View File

@@ -2,15 +2,16 @@
import Link from "next/link";
import { usePathname } from "next/navigation";
import { useTranslation } from "react-i18next";
import { cn } from "@/lib/utils";
const LINKS: { href: string; label: string; match?: "exact" | "prefix" }[] = [
{ href: "/admin/config/plays", label: "玩法配置" },
{ href: "/admin/config/odds", label: "赔率配置" },
{ href: "/admin/config/rebate", label: "佣金 / 回水" },
{ href: "/admin/config/risk-cap", label: "风控封顶" },
{ href: "/admin/config/wallet", label: "钱包配置" },
const LINKS: { href: string; key: string; match?: "exact" | "prefix" }[] = [
{ href: "/admin/config/plays", key: "plays" },
{ href: "/admin/config/odds", key: "odds" },
{ href: "/admin/config/rebate", key: "rebate" },
{ href: "/admin/config/risk-cap", key: "risk-cap" },
{ href: "/admin/config/wallet", key: "wallet" },
];
function linkActive(pathname: string, href: string, match: "exact" | "prefix"): boolean {
@@ -21,14 +22,15 @@ function linkActive(pathname: string, href: string, match: "exact" | "prefix"):
}
export function ConfigSubNav() {
const { t } = useTranslation("config");
const pathname = usePathname();
return (
<nav
className="flex flex-wrap gap-2 border-b border-border pb-3 mb-6"
aria-label="运营配置子导航"
aria-label={t("nav.aria")}
>
{LINKS.map(({ href, label, match = "prefix" }) => {
{LINKS.map(({ href, key, match = "prefix" }) => {
const active = linkActive(pathname, href, match);
return (
<Link
@@ -41,7 +43,7 @@ export function ConfigSubNav() {
: "bg-muted/60 text-muted-foreground hover:bg-muted hover:text-foreground",
)}
>
{label}
{t(`nav.items.${key}`)}
</Link>
);
})}