mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-21 22:50:42 +08:00
24 lines
586 B
TypeScript
24 lines
586 B
TypeScript
import { LanguagesIcon } from "lucide-react";
|
|
import { useTranslation } from "react-i18next";
|
|
import { Button } from "./ui/button";
|
|
|
|
export function LanguageSwitcher() {
|
|
const { i18n } = useTranslation();
|
|
|
|
const toggleLanguage = () => {
|
|
const newLang = i18n.language === "en" ? "zh-CN" : "en";
|
|
i18n.changeLanguage(newLang);
|
|
};
|
|
|
|
return (
|
|
<Button
|
|
variant="ghost"
|
|
size="icon"
|
|
onClick={toggleLanguage}
|
|
title={i18n.language === "en" ? "Switch to Chinese" : "切换到英文"}
|
|
>
|
|
<LanguagesIcon className="h-5 w-5" />
|
|
</Button>
|
|
);
|
|
}
|