diff --git a/frontend/src/components/language-switcher.tsx b/frontend/src/components/language-switcher.tsx new file mode 100644 index 0000000..69d06ba --- /dev/null +++ b/frontend/src/components/language-switcher.tsx @@ -0,0 +1,41 @@ +'use client'; + +import { useTranslation, locales } from '@/lib/i18n'; +import { Button } from '@/components/ui/button'; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from '@/components/ui/dropdown-menu'; +import { Globe } from 'lucide-react'; + +export function LanguageSwitcher() { + const { locale, setLocale } = useTranslation(); + + const currentLocale = locales.find(l => l.code === locale); + + return ( + + + + + + {locales.map((l) => ( + setLocale(l.code)} + className={locale === l.code ? 'bg-accent' : ''} + > + {l.flag} + {l.name} + + ))} + + + ); +}