"use client"; import { useParams, usePathname, useRouter } from 'next/navigation'; import { useTranslations } from 'next-intl'; import { cn } from '@/lib/utils'; import { locales } from '@/i18n/request'; export function LanguageSwitcher({ className }: { className?: string }) { const router = useRouter(); const pathname = usePathname(); const params = useParams(); const t = useTranslations('language'); const currentLocale = params.locale as string; const handleLanguageChange = (newLocale: string) => { // Get the path without the locale prefix const pathWithoutLocale = pathname.replace(`/${currentLocale}`, ''); // Navigate to the same page with the new locale router.push(`/${newLocale}${pathWithoutLocale}`); }; return (