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

@@ -4,6 +4,7 @@ import Link from "next/link";
import { usePathname } from "next/navigation";
import { useMemo } from "react";
import { SparklesIcon } from "lucide-react";
import { useTranslation } from "react-i18next";
import {
Sidebar,
@@ -33,6 +34,7 @@ function isActive(pathname: string, item: { href: string; activeMatchPrefix?: st
}
export function AdminAppSidebar() {
const { t } = useTranslation(["common", "dashboard", "players", "draws", "config", "wallet", "risk", "settlement", "jackpot", "reconcile", "tickets", "reports", "audit"]);
const pathname = usePathname();
const profile = useAdminProfile();
const visibleNav = useMemo(
@@ -55,7 +57,7 @@ export function AdminAppSidebar() {
<SparklesIcon data-icon="inline-start" aria-hidden />
<div className="flex flex-col items-start gap-0 group-data-[collapsible=icon]:hidden">
<span className="font-semibold tracking-tight text-sidebar-foreground">
{t("app.title", { ns: "common" })}
</span>
<span className="text-[11px] leading-tight text-sidebar-foreground/70">
Lottery Admin
@@ -67,7 +69,7 @@ export function AdminAppSidebar() {
</SidebarHeader>
<SidebarContent>
<SidebarGroup>
<SidebarGroupLabel></SidebarGroupLabel>
<SidebarGroupLabel>{t("sidebar.workspace", { ns: "common", defaultValue: "Workspace" })}</SidebarGroupLabel>
<SidebarGroupContent>
<SidebarMenu>
{visibleNav.map((item) => {
@@ -75,12 +77,12 @@ export function AdminAppSidebar() {
return (
<SidebarMenuItem key={item.segment}>
<SidebarMenuButton
tooltip={item.label}
tooltip={t(`nav.${item.segment}`, { ns: "common", defaultValue: item.label })}
isActive={isActive(pathname, item)}
render={<Link href={item.href} />}
>
<Icon data-icon="inline-start" aria-hidden />
<span>{item.label}</span>
<span>{t(`nav.${item.segment}`, { ns: "common", defaultValue: item.label })}</span>
</SidebarMenuButton>
</SidebarMenuItem>
);