Internationalization (i18n)
BlueForm translates at the form level, not inside field components. Labels, descriptions, placeholders and error messages are translated before they reach a field: useField() returns ready-to-render strings, so field components never deal with locales or an i18n library.
i18n is optional: without i18nConfig, every text is shown as written. Runnable examples (a hand-written t, JSON files, your own language store, i18next, react-intl, Lingui, Paraglide JS): i18n recipe.
t; your component gets finished strings from useField() and its props. A new t (the language changed): BlueForm translates again, the values are kept.One function: t
Everything goes through i18nConfig.t(key, params):
BlueForm does not dictate a key format or where messages come from: t can be a switch, a lookup in JSON files, or an i18n library's function. For a key it does not know, a good t returns the key itself (i18next does by default): plain text then shows unchanged next to translated text.
Where the config lives: setupForm and <Form>
i18nConfig can be given to setupForm, to a <Form>, or both. They are merged key by key, and the Form's keys win (v0.22+; before, a Form's i18nConfig replaced the setup's entirely). This is the same rule as formOptions.
How the merge resolves:
- A key on the Form replaces the same key from
setupForm; the other keys are kept. Override one key or all of them. - The merge is shallow: a Form's
validationTranslationreplaces the setup's whole map, it is not merged rule by rule. - A key set to
undefinedon the Form drops the setup's value for that form (e.g.validationTranslation: undefined). - Without a Form
i18nConfig, the setup's applies as is.
When t comes from a hook, wrap the wiring once in a hook of your app and pass its result, so forms do not repeat it:
A static t in setupForm (e.g. i18next.t) is enough when the app has one language, or reloads the page to switch.
Switching language
A new t function means the language changed. When the Form receives one:
- labels, descriptions and placeholders are translated again;
- fields that show a validation error are validated again, so their messages follow; fields without an error are not validated;
- errors set with
setError()(e.g. a server error) are kept, and translated again as they are displayed; - the values are kept: nothing is remounted.
So keep t stable within a language and new only when it changes. The hooks of i18n libraries already do that; a hand-written t needs a useMemo keyed on the language. A new function on every render reads as a language change on every render.
A changing t can come from:
- an i18n library's hook:
useTranslation(),useIntl(),useLingui(); - your own language store, subscribed with
useSyncExternalStore:getLang/setLangkeep the language where you want (localStorage, a cookie, the URL) andsetLangnotifies the form. See Your own translator for the code and its trade-offs.
Validation messages
validationTranslation maps the built-in rules to message keys, so rules stay plain RHF rules:
{field} is the translated label and the rule value is a param. The message replaces the field's own message for that rule. Other errors (schema, setError(), validate) are translated when they are shown, without params.- It covers
required,min,max,minLength,maxLengthandpattern(notvalidate, whose functions return their own message). treceives the key and{ field, <rule>: value }:fieldis the translated label, and e.g.minLength: 3forminLength.- It replaces the field's own message for that rule (
rules: { required: "Name is needed" }shows thevalidation.requiredmessage). Leave a rule out ofvalidationTranslationto keep per-field messages for it.
Custom error messages
Every error message goes through t when it is displayed, so custom messages can be keys too:
These are translated without params. For a message with parameters, use validationTranslation, or build the message with your t in a config rebuilt when the language changes: the field is validated again with the new function.
Messages read directly from formState.errors are the raw keys.
Text forms
label, description and props.placeholder accept a TranslatableText:
A t that returns the key for unknown keys (as i18next does) never returns undefined, so fallback is not used with it.
Use the literal form for text that is not a key, e.g. labels loaded from a database, so your i18n library does not warn about missing keys:
Placeholders and other props
v0.23+ (before, through translateProps)
props.placeholder is translated like a label: a key, { message, params } or { text }. Other field props are passed through untouched, since most are not text (type, variant, size) and sending them to t would make the i18n library report missing keys.
Help text goes in the field's description, translated, and the adapter passes it to the library's prop (Mantine description, MUI helperText). Other text props (title, aria-label) and nested values such as select options are translated where you build the config, with your t: each UI library shapes options differently (data, options, <option> children).
Type-checked keys
Added in v0.14.
Register your key union once with module augmentation, and label / description (including { message }) only accept known keys: typos fail at compile time. { text } still accepts any string.
Turning i18n off
With enabled: false (in setupForm or on one Form), t is not called: keys are shown as is, { message } shows its message, and { text } its text.

