mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-06 10:47:12 +08:00
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import { Button } from "@nous-research/ui/ui/components/button";
|
|
import { Typography } from "@/components/NouiTypography";
|
|
import { useI18n } from "@/i18n/context";
|
|
|
|
/**
|
|
* Compact language toggle — shows a clickable flag that switches between
|
|
* English and Chinese. Persists choice to localStorage.
|
|
*/
|
|
export function LanguageSwitcher() {
|
|
const { locale, setLocale, t } = useI18n();
|
|
|
|
const toggle = () => setLocale(locale === "en" ? "zh" : "en");
|
|
|
|
return (
|
|
<Button
|
|
ghost
|
|
onClick={toggle}
|
|
title={t.language.switchTo}
|
|
aria-label={t.language.switchTo}
|
|
className="px-2 py-1 normal-case tracking-normal font-normal text-xs text-muted-foreground hover:text-foreground"
|
|
>
|
|
<span className="inline-flex items-center gap-1.5">
|
|
<span className="text-base leading-none">
|
|
{locale === "en" ? "🇬🇧" : "🇨🇳"}
|
|
</span>
|
|
|
|
<Typography
|
|
mondwest
|
|
className="hidden sm:inline tracking-wide uppercase text-[0.65rem]"
|
|
>
|
|
{locale === "en" ? "EN" : "中文"}
|
|
</Typography>
|
|
</span>
|
|
</Button>
|
|
);
|
|
}
|