'use client'; import { useRouter } from 'next/navigation'; import { useLocale, useTranslations } from 'next-intl'; import { useTransition } from 'react'; export function LocaleSwitcher() { const router = useRouter(); const locale = useLocale(); const t = useTranslations('locale'); const [isPending, startTransition] = useTransition(); function switchLocale() { const newLocale = locale === 'de' ? 'en' : 'de'; document.cookie = `NEXT_LOCALE=${newLocale};path=/;max-age=31536000`; startTransition(() => { router.refresh(); }); } const currentLabel = locale === 'de' ? t('de') : t('en'); return ( ); }