Skip to main content

Localization

UniForm ships with built-in locale packs as separate subpath exports. Only the locale you import ends up in your bundle — unused locales are never loaded.

Using a locale pack

import { es } from '@uniform-ts/core/locales/es'
import { AutoForm } from '@uniform-ts/core'

<AutoForm form={myForm} labels={es} onSubmit={handleSubmit} />

Available locales

Import pathLanguage
@uniform-ts/core/locales/enEnglish
@uniform-ts/core/locales/heHebrew
@uniform-ts/core/locales/esSpanish

Overriding individual keys

Locale packs are plain objects — spread them and override any key you need:

import { es } from '@uniform-ts/core/locales/es'

<AutoForm labels={{ ...es, submit: 'Guardar cambios' }} ... />

Factory-level locale

Set a locale once in createAutoForm so every form instance inherits it:

import { createAutoForm } from '@uniform-ts/core'
import { he } from '@uniform-ts/core/locales/he'

const AutoForm = createAutoForm({ labels: he })

Per-instance labels props are shallow-merged on top, so individual forms can still override specific keys.

FormLabels reference

All keys are optional. Any key you omit falls back to the English default.

KeyTypeDefaultDescription
submitstring"Submit"Submit button text
arrayAddstring"Add"Add-row button text
arrayRemovestring"Remove"Remove-row button text
arrayMoveUpstring"↑"Move-up button text
arrayMoveDownstring"↓"Move-down button text
arrayDuplicatestring"Duplicate"Duplicate-row button text
arrayCollapsestring"▼"Collapse toggle (row is expanded)
arrayExpandstring"▶"Expand toggle (row is collapsed)
arrayItemSummary(index: number) => string`Item ${n}`Collapsed row fallback label
arrayAriaExpand(index: number) => string`Expand item ${n}`Aria label for the expand toggle
arrayAriaCollapse(index: number) => string`Collapse item ${n}`Aria label for the collapse toggle
arrayAriaMoveUp(index: number) => string`Move item ${n} up`Aria label for the move-up button
arrayAriaMoveDown(index: number) => string`Move item ${n} down`Aria label for the move-down button
arrayAriaDuplicate(index: number) => string`Duplicate item ${n}`Aria label for the duplicate button
arrayAriaRemove(index: number) => string`Remove item ${n}`Aria label for the remove button

Adding a custom locale

A locale is just a FormLabels object — create one for any language:

import type { FormLabels } from '@uniform-ts/core'

export const fr: FormLabels = {
submit: 'Envoyer',
arrayAdd: 'Ajouter',
arrayRemove: 'Supprimer',
arrayMoveUp: '↑',
arrayMoveDown: '↓',
arrayDuplicate: 'Dupliquer',
arrayCollapse: '▼',
arrayExpand: '▶',
arrayItemSummary: (i) => `Élément ${i + 1}`,
arrayAriaExpand: (i) => `Développer l'élément ${i + 1}`,
arrayAriaCollapse: (i) => `Réduire l'élément ${i + 1}`,
arrayAriaMoveUp: (i) => `Déplacer l'élément ${i + 1} vers le haut`,
arrayAriaMoveDown: (i) => `Déplacer l'élément ${i + 1} vers le bas`,
arrayAriaDuplicate: (i) => `Dupliquer l'élément ${i + 1}`,
arrayAriaRemove: (i) => `Supprimer l'élément ${i + 1}`,
}