'use client'; import { useLocale, useTranslations } from 'next-intl'; import type { Locale } from '@/i18n/config'; import { usePathname, useRouter } from '@/i18n/navigation'; const localeLabels: Record = { vi: '🇻🇳 VI', en: '🇬🇧 EN', }; export function LanguageSwitcher() { const locale = useLocale() as Locale; const router = useRouter(); const pathname = usePathname(); const t = useTranslations('language'); const switchLocale = (newLocale: Locale) => { router.replace(pathname, { locale: newLocale }); }; const nextLocale: Locale = locale === 'vi' ? 'en' : 'vi'; return ( ); }