import { Button } from "@tailor-platform/app-shell"; import { Fragment } from "react"; import { useT } from "@/i18n/labels"; import { useAppLocale, type AppLocale } from "@/i18n/locale"; // Locale codes are shown as-is (never translated) so each stays recognisable. const LOCALE_NAMES: Record = { en: "EN", ja: "JA", }; /** * Language switcher for the sidebar. Mirrors the Tailor UI Catalogue pattern: * a "Language" heading with inline `EN / JA` link toggles when the sidebar is * expanded, collapsing to stacked compact buttons in the icon rail. * * app-shell has no locale setter, so this drives the app-owned locale state * (see `@/i18n/locale`), which App.tsx feeds into `` — * flipping it re-resolves every `t()` label. */ export const LanguageSwitcher = () => { const t = useT(); const { locale, setLocale, supported } = useAppLocale(); const heading = t("nav.language"); return (
{/* Expanded sidebar: "Language EN / JA" inline link toggles. */}
{heading}
{supported.map((l, i) => ( {i > 0 && /} ))}
{/* Collapsed icon rail: stacked compact buttons. */}
{supported.map((l) => ( ))}
); };