初步集成next-intl支持多语言
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
PlugZap,
|
||||
Settings,
|
||||
} from "lucide-react"
|
||||
import { useTranslations } from "next-intl"
|
||||
import { usePathname } from "next/navigation"
|
||||
import { useRouter } from "next/navigation"
|
||||
import { Button } from "@/components/ui/button"
|
||||
@@ -18,39 +19,39 @@ import { AppTitleBar } from "@/components/layout/app-title-bar"
|
||||
|
||||
interface SettingsNavItem {
|
||||
href: string
|
||||
label: string
|
||||
labelKey: string
|
||||
icon: ComponentType<{ className?: string }>
|
||||
}
|
||||
|
||||
const SETTINGS_NAV_ITEMS: SettingsNavItem[] = [
|
||||
{
|
||||
href: "/settings/appearance",
|
||||
label: "Appearance",
|
||||
labelKey: "appearance",
|
||||
icon: Palette,
|
||||
},
|
||||
{
|
||||
href: "/settings/agents",
|
||||
label: "Agents",
|
||||
labelKey: "agents",
|
||||
icon: Bot,
|
||||
},
|
||||
{
|
||||
href: "/settings/mcp",
|
||||
label: "MCP",
|
||||
labelKey: "mcp",
|
||||
icon: PlugZap,
|
||||
},
|
||||
{
|
||||
href: "/settings/skills",
|
||||
label: "Skills",
|
||||
labelKey: "skills",
|
||||
icon: BookOpenText,
|
||||
},
|
||||
{
|
||||
href: "/settings/shortcuts",
|
||||
label: "Shortcuts",
|
||||
labelKey: "shortcuts",
|
||||
icon: Keyboard,
|
||||
},
|
||||
{
|
||||
href: "/settings/system",
|
||||
label: "System",
|
||||
labelKey: "system",
|
||||
icon: Settings,
|
||||
},
|
||||
]
|
||||
@@ -73,6 +74,7 @@ function isWindowsRuntime(): boolean {
|
||||
}
|
||||
|
||||
export function SettingsShell({ children }: SettingsShellProps) {
|
||||
const t = useTranslations("SettingsShell")
|
||||
const pathname = usePathname()
|
||||
const router = useRouter()
|
||||
const normalizedPathname = normalizePath(pathname)
|
||||
@@ -101,14 +103,14 @@ export function SettingsShell({ children }: SettingsShellProps) {
|
||||
<div className="h-screen flex flex-col overflow-hidden bg-background text-foreground">
|
||||
<AppTitleBar
|
||||
center={
|
||||
<div className="text-sm font-bold tracking-tight">Settings</div>
|
||||
<div className="text-sm font-bold tracking-tight">{t("title")}</div>
|
||||
}
|
||||
/>
|
||||
|
||||
<div className="flex-1 min-h-0 flex">
|
||||
<aside className="w-56 shrink-0 border-r p-3">
|
||||
<div className="px-1 pb-2 text-[11px] font-medium text-muted-foreground">
|
||||
Preferences
|
||||
{t("preferences")}
|
||||
</div>
|
||||
<nav className="space-y-1">
|
||||
{SETTINGS_NAV_ITEMS.map((item) => {
|
||||
@@ -128,7 +130,7 @@ export function SettingsShell({ children }: SettingsShellProps) {
|
||||
>
|
||||
<span className="inline-flex items-center gap-1">
|
||||
<Icon className="h-3.5 w-3.5" />
|
||||
{item.label}
|
||||
{t(`nav.${item.labelKey}`)}
|
||||
</span>
|
||||
</Button>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user