refactor: support i18n

This commit is contained in:
mlogclub
2026-05-25 12:06:15 +08:00
parent 309ac1fe9e
commit 988f55c80d
179 changed files with 10968 additions and 3763 deletions
+6 -2
View File
@@ -3,8 +3,10 @@
import { useEffect, useRef } from "react"
import { usePathname } from "next/navigation"
import { LocaleSwitcher } from "@/components/locale-switcher"
import { RealtimeConnectionStatus } from "@/components/realtime-connection-status"
import { getPageTitle } from "@/lib/navigation"
import { useI18n } from "@/i18n/provider"
import { getPageTitleKey } from "@/lib/navigation"
import { useAgentConversationsStore } from "@/lib/stores/agent-conversations"
import { PaletteToggle } from "@/components/palette-toggle"
import { ThemeToggle } from "@/components/theme-toggle"
@@ -20,9 +22,10 @@ import { SidebarTrigger, useSidebar } from "@/components/ui/sidebar"
const SIDEBAR_STORAGE_KEY = "dashboard_sidebar_open"
export function SiteHeader() {
const t = useI18n()
const pathname = usePathname()
const { open, setOpen, isMobile } = useSidebar()
const pageTitle = getPageTitle(pathname)
const pageTitle = t(getPageTitleKey(pathname))
const realtimeStatus = useAgentConversationsStore((state) => state.realtimeStatus)
const hasRestoredRef = useRef(false)
const showConversationRealtime =
@@ -75,6 +78,7 @@ export function SiteHeader() {
</div>
</div>
<div className="flex items-center justify-end gap-2">
<LocaleSwitcher />
<PaletteToggle />
<ThemeToggle />
</div>