mirror of
https://github.com/parsis-foundation/parsis.foundation.git
synced 2026-10-30 20:47:22 +00:00
- Transform from personal site to foundation/NGO site - Focus on education, research, AI, cryptography, open governance - Update all translations and navigation - Update package.json metadata
25 lines
795 B
TypeScript
25 lines
795 B
TypeScript
'use client';
|
|
|
|
import { useI18n } from '@/lib/i18n/context';
|
|
import { Locale } from '@/lib/i18n';
|
|
|
|
export function LanguageSwitcher() {
|
|
const { locale, setLocale } = useI18n();
|
|
|
|
const toggleLocale = () => {
|
|
setLocale(locale === 'en' ? 'fa' : 'en');
|
|
};
|
|
|
|
return (
|
|
<button
|
|
onClick={toggleLocale}
|
|
className="flex items-center gap-2 rounded-lg border border-white/10 bg-card/50 px-3 py-1.5 text-sm transition-colors hover:bg-card"
|
|
aria-label={locale === 'en' ? 'Switch to Farsi' : 'Switch to English'}
|
|
>
|
|
<span className={locale === 'en' ? 'text-gold' : 'text-muted-foreground'}>EN</span>
|
|
<span className="text-muted-foreground">/</span>
|
|
<span className={locale === 'fa' ? 'text-gold' : 'text-muted-foreground'}>فا</span>
|
|
</button>
|
|
);
|
|
}
|