'use client' import { Fragment } from 'react' import Link from 'next/link' import { usePathname } from 'next/navigation' import { LOCALE_NAMES, languageLinks } from '@/lib/i18n' /** * MITHOME-115: compact "HU | EN" switcher. Each link keeps the current page * in the other language (translated slug, src/lib/i18n.ts languageLinks). * * DECISION (user): English is always offered, even before a page's English * translation is approved — the page then shows Hungarian text (MITHOME-113 * gate). No flags: a flag marks a country, not a language. * WHY `lang`/`hrefLang` on the links: screen readers pronounce "English" * correctly on a Hungarian page (WCAG 3.1.2). */ export function LanguageSwitcher({ label }: { label: string }) { const links = languageLinks(usePathname() ?? '/') return (
{links.map((link, index) => ( {index > 0 && ( )} {LOCALE_NAMES[link.locale].code} ))}
) }