"use client"; import { Languages } from "lucide-react"; import { usePathname } from "next/navigation"; import { Button } from "@/components/ui/button"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import { AppLocale, getLocalizedPath, stripLocalePrefix } from "@/lib/locale"; import { cn } from "@/lib/utils"; type LocaleToggleProps = { locale: string; className?: string; showLabel?: boolean; }; export function LocaleToggle({ locale, className, showLabel = false }: LocaleToggleProps) { const pathname = usePathname(); const locales: AppLocale[] = ["de", "en", "ar"]; const currentPath = stripLocalePrefix(pathname); const currentLocale = (["de", "en", "ar"].includes(locale) ? locale : "de") as AppLocale; return ( {locales.map((targetLocale) => ( {targetLocale.toUpperCase()} {targetLocale === currentLocale ? ( Active ) : null} ))} ); }