"use client"; import { useAppLocale, useLocaleActions } from "./LocaleProvider"; import type { AppLocale } from "./locale"; export function LocaleSwitcher() { const locale = useAppLocale(); const { setLocale } = useLocaleActions(); const handleToggle = () => { const nextLocale: AppLocale = locale === "en" ? "ko" : "en"; setLocale(nextLocale); try { const maxAgeSeconds = 60 * 60 * 24 * 365; // 1 year document.cookie = `pb-locale=${nextLocale}; path=/; max-age=${maxAgeSeconds}`; } catch { // 쿠키 저장 실패는 무시 (로케일 상태는 여전히 컨텍스트에서 유지된다) } }; const labelText = locale === "en" ? "EN" : "KO"; return (
); }