'use client'; import {useLocaleContext} from '@/contexts/LocaleContext'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '@/components/ui/select'; import {Globe} from 'lucide-react'; /** * Language switcher component * Allows users to change the application language * Persists preference in localStorage */ export function LanguageSwitcher() { const {locale, setLocale} = useLocaleContext(); // Supported languages configuration const languages = [ {code: 'en' as const, name: 'English', flag: '🇺🇸'}, {code: 'zh' as const, name: '简体中文', flag: '🇨🇳'}, ]; /** * Handle language change * Updates locale in context and localStorage */ const handleLanguageChange = (newLocale: string) => { setLocale(newLocale as 'en' | 'zh'); }; return ( ); }