"use client";
import { Globe } from "lucide-react";
import type { Locale } from "./locale-toggle";
export function LocaleToggleClient({
current,
variant = "retro",
}: { current: Locale; variant?: "retro" | "navbar" }) {
function setLocale(next: Locale) {
if (next === current) return;
document.cookie = `locale=${next}; path=/; max-age=${60 * 60 * 24 * 365}; SameSite=Lax`;
// Hard reload, not router.refresh(): the latter re-fetches the route's
// server tree but Next.js can keep a stale
/ because metadata
// is rendered up in the layout tree which isn't always re-invalidated.
// A full navigation re-runs generateMetadata against the new cookie, so
// the tab title, OG tags, and html lang attribute all switch together.
window.location.reload();
}
if (variant === "navbar") {
// Gold-amber magazine theme to match SiteHeader / BureauNav.
// The active locale fills with gold; the inactive one stays muted text.
// Sized to be unmistakably readable in the navbar — the previous 11px pill
// disappeared visually next to the other links.
return (