'use client' import {useLocale} from 'next-intl' import {redirect} from 'next/navigation' import {Link, usePathname, useRouter} from '@/i18n/routing' import {Label} from '@/ui/label' import {Switch} from '@/ui/switch' export default function LocaleSwitcher() { const router = useRouter() const pathname = usePathname() const locale = useLocale() const initialState = locale !== 'uk' const handler = (state: boolean) => { const newPath = `/${locale}${pathname}` //window.history.replaceState(null, '', newPath) const link = document.getElementById('lang-switch') if (link) { link.innerText = `${state ? '/ru' : ''}${pathname}` link.setAttribute('href', `${state ? '/ru' : ''}${pathname}`) link.click() } } // router.replace('/cabinet', {locale: checked ? 'ru' : 'uk'} return (
LA
) }