Composants · Référence
Editing Locale Switcher
A compact localized select for choosing which locale is being edited in multilingual forms.
Dernière mise à jour le 28 septembre 2026
Overview
editing-locale-switcher provides a small form control for switching the active editing locale in multilingual forms. It is useful for forms that store localized fields in metadata or translation maps.
Set the active locale once with KrakstackProvider; pass locale directly only when a component needs an override. Message overrides are keyed by arbitrary locale strings, so additional languages can be supplied with messages={{ es: { ... } }}. Exact locale keys such as es-MX take precedence over base keys such as es; English is the final fallback.
Install
shell
bunx shadcn@latest add @krak-stack/editing-locale-switcherFeatures
- Arbitrary editing locale strings with English and French defaults
- Controlled
valueandonValueChangeprops - Mobile-friendly icon label with desktop text
- In-file English and French labels with optional message overrides
Usage
tsx
import { EditingLocaleSwitcher, type EditingLocale } from "@/components/ui/editing-locale-switcher";
import { useState } from "react";
const [locale, setLocale] = useState<EditingLocale>("en");
<EditingLocaleSwitcher locale={uiLocale} value={locale} onValueChange={setLocale} />
<EditingLocaleSwitcher
locale={uiLocale}
locales={["en", "fr", "es"]}
value={locale}
onValueChange={setLocale}
messages={{ en: { label: "Language", es: "Spanish" } }}
/>Dependencies
Packages and shadcn components required by this registry item.