'use client' import i18nConfig from '@/i18nConfig' import { usePathname, useRouter } from 'next/navigation' import { useTransition } from 'react' import { Globe } from 'lucide-react' export function LanguageSwitcher() { const router = useRouter() const pathname = usePathname() const [isPending, startTransition] = useTransition() const currentLocale = pathname.split('/')[1] || i18nConfig.defaultLocale const handleChange = (e: React.ChangeEvent) => { const newLocale = e.target.value const segments = pathname.split('/') segments[1] = newLocale const newPath = segments.join('/') startTransition(() => { router.push(newPath) }) } return (
) }