Files
0pt/components/locale-switcher.tsx
T
adminandClaude Opus 4.8 0ab1818722 feat(i18n): English-base + Swedish toggle (locale provider, switcher, ~20 surfaces converted)
Locale provider (en default, persisted) + EN/SV switcher in header; converted header + landing sections + catalog/sources/order-flow/most-of-portal to useT({en,sv}). Fixed two partial conversions (forskott TRUST object/tuple map; kallor undefined ALL + raw object renders). tsc 0, build green. Remaining: admin/* + a few partials.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 02:39:57 +02:00

31 lines
965 B
TypeScript

"use client";
import { useLocale, type Locale } from "@/components/locale-provider";
const LOCALES: Locale[] = ["en", "sv"];
export function LocaleSwitcher() {
const { locale, setLocale } = useLocale();
return (
<div className="flex items-center gap-1 font-mono text-[11px] uppercase tracking-[0.12em]">
{LOCALES.map((l, i) => (
<span key={l} className="flex items-center gap-1">
<button
type="button"
onClick={() => setLocale(l)}
aria-pressed={locale === l}
className="px-1 py-0.5 transition-colors"
style={{
color: locale === l ? "var(--foreground)" : "var(--muted-foreground)",
borderBottom: locale === l ? "1px solid var(--accent-red)" : "1px solid transparent",
}}
>
{l}
</button>
{i === 0 ? <span className="text-border">/</span> : null}
</span>
))}
</div>
);
}