where the time is
{mouted ? (
diff --git a/src/components/LanguageSwitcher.tsx b/src/components/LanguageSwitcher.tsx
new file mode 100644
index 0000000..872ebe1
--- /dev/null
+++ b/src/components/LanguageSwitcher.tsx
@@ -0,0 +1,56 @@
+"use client";
+
+import { Button } from "@/components/ui/button";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from "@/components/ui/dropdown-menu";
+
+import { CheckCircleIcon } from "@heroicons/react/20/solid";
+import { useTranslation } from "react-i18next";
+
+export function LanguageSwitcher() {
+ const { t, i18n } = useTranslation();
+
+ const locale = i18n.language;
+
+ const handleSelect = (e: Event, newLocale: string) => {
+ e.preventDefault(); // 阻止默认的关闭行为
+ i18n.changeLanguage(newLocale);
+ };
+
+ const localeItems = [
+ { name: t("language.zh-CN"), code: "zh-CN" },
+ { name: t("language.zh-TW"), code: "zh-TW" },
+ { name: t("language.en"), code: "en" },
+ ];
+
+ return (
+
+
+
+
+
+ {localeItems.map((item) => (
+ handleSelect(e, item.code)}
+ className={locale === item.code ? "bg-muted gap-3" : ""}
+ >
+ {item.name}{" "}
+ {locale === item.code && }
+
+ ))}
+
+
+ );
+}
diff --git a/src/components/ThemeSwitcher.tsx b/src/components/ThemeSwitcher.tsx
index b8b1384..2926e14 100644
--- a/src/components/ThemeSwitcher.tsx
+++ b/src/components/ThemeSwitcher.tsx
@@ -9,8 +9,11 @@ import { cn } from "@/lib/utils";
import { Moon, Sun } from "lucide-react";
import { Theme } from "@/components/ThemeProvider";
import { useTheme } from "../hooks/use-theme";
+import { CheckCircleIcon } from "@heroicons/react/20/solid";
+import { useTranslation } from 'react-i18next';
export function ModeToggle() {
+ const {t} = useTranslation();
const { setTheme, theme } = useTheme();
const handleSelect = (e: Event, newTheme: Theme) => {
@@ -36,19 +39,22 @@ export function ModeToggle() {
className={cn({ "gap-3 bg-muted": theme === "light" })}
onSelect={(e) => handleSelect(e, "light")}
>
- Light
+ {t("theme.light")}
+ {theme === "light" &&
}
handleSelect(e, "dark")}
>
- Dark
+ {t("theme.dark")}
+ {theme === "dark" && }
handleSelect(e, "system")}
>
- System
+ {t("theme.system")}
+ {theme === "system" && }
diff --git a/src/components/ui/dropdown-menu.tsx b/src/components/ui/dropdown-menu.tsx
index e209caa..702e290 100644
--- a/src/components/ui/dropdown-menu.tsx
+++ b/src/components/ui/dropdown-menu.tsx
@@ -63,7 +63,7 @@ const DropdownMenuContent = React.forwardRef<
ref={ref}
sideOffset={sideOffset}
className={cn(
- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-2xl data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
className,
)}
{...props}
@@ -81,7 +81,7 @@ const DropdownMenuItem = React.forwardRef<