Guides
Internationalization
FormKrafter separates two things most libraries conflate: the content of a form (authored by whoever built it) and the chrome of the builder (the UI your users click through). They are localized independently, and neither ever sniffs the browser language — the host decides, the library follows.
Layer 1 — form content
Section titled “Layer 1 — form content”Any label, placeholder, message or option list in a spec may be a plain string or an object keyed by locale:
{ "label": { "en": "Full name", "fr": "Nom complet" } }Pass locale to the renderer to resolve it:
<FkFormRender spec={spec} locale="fr" /><FkFormRender :spec="spec" locale="fr" />document.querySelector('fk-form-render').locale = 'fr'In the builder, pass locales to get an edit-language selector — panel fields
then read and write the selected language:
<FkFormBuilder locales={['en', 'fr']} />Layer 2 — builder chrome
Section titled “Layer 2 — builder chrome”The palette, property panel, buttons and brick names are about 90 translation keys. English is built in and French ships in the package:
import { setFkTranslations, frFkTranslations } from '@streamline-pulse/formkrafter-wc'
setFkTranslations(frFkTranslations)For any other language, pass your own dictionary — it is merged over the built-in English, so a partial translation is valid:
setFkTranslations({ 'palette.search': 'Bausteine suchen…', 'panel.validation': 'Validierung',})Choosing a locale
Section titled “Choosing a locale”Because nothing is automatic, the choice is explicitly yours — a URL segment, a user preference, a cookie. A typical wiring:
import { setFkTranslations, frFkTranslations } from '@streamline-pulse/formkrafter-wc'
const locale = useRouteLocale() // your router, your ruleif (locale === 'fr') setFkTranslations(frFkTranslations)
return <FkFormRender spec={spec} locale={locale} />Next steps
Section titled “Next steps”A project by Streamline Pulse