Back to blog

Multilingual Dynamic Forms in Laravel: Stable Data Across Locales

Manuk Minasyan · · 4 min read
Multilingual Dynamic Forms in Laravel: Stable Data Across Locales

Laravel language files translate system UI. They do not automatically translate titles, field labels, help text, placeholders, options, or success messages stored inside a dynamic form schema.

A multilingual form has three localization layers:

  1. System chrome: Submit, Next, errors, unavailable states.
  2. Author content: title, labels, help, placeholders, options, confirmation copy.
  3. Submission context: the locale and revision the respondent saw, plus notification/export presentation.

Keeping those layers separate prevents a language switch from changing stored meaning or splitting analytics.

Compare the schema models

ModelStrengthWeaknessBest fit
Clone form per localeWorks immediatelyLogic drift and split analyticsFast workaround
Translation maps in schemaOne form and stable codesCustom builder/render logicFew locales
Translation tableWorkflow and query flexibilityMore joins/admin UIMany locales and editors

A translation map might store label.en, label.fr, and label.ar, while the field code remains one language-neutral ULID. The same applies to option values: store enterprise, not the displayed English or Arabic label.

Persist locale and revision

Store locale and form_version_id on every submission and draft. Historical display can then render the exact revision using the locale the respondent saw.

If option labels come from mutable external records, decide whether the historical label comes from the revision or a submission snapshot. Never infer the old language from the administrator currently viewing the record.

The form versioning guide covers the immutable revision relationship.

Resolve locale before Livewire mounts

Set locale through a trusted route/domain preference before rendering the component. Ensure the localization middleware persists across Livewire update requests; otherwise the initial page may be French while validation updates fall back to English.

Livewire documents persistent/custom update middleware in its security guide. Keep the selected locale allowlisted and store it in trusted component/draft context rather than accepting arbitrary language identifiers.

Translate validation for humans

Laravel can translate rule messages, custom attributes, and values. Dynamic fields need a locale-aware mapping from immutable code to label, or errors will expose internal identifiers.

Translate both:

See Laravel localization and validation message translation.

Language and direction are separate

Set a correct <html lang> and switch dir="rtl" for right-to-left locales such as Arabic. Language metadata alone does not establish directionality. Use logical CSS properties, test mixed-direction values such as email addresses, and inspect focus/error ordering.

W3C maintains separate guidance for language declarations and page direction.

Localization also includes date/time formats, decimal separators, names, address expectations, phone inputs, pluralization, and file constraints. A translated label on a US-specific input mask is not a localized form.

Queue notifications with explicit locale

A worker does not inherit the browser request locale. Store the submission locale and apply it when sending confirmations or rendering exports. Laravel supports localized notifications.

Administrative notifications may use the recipient's locale while including the respondent's locale as metadata. Do not silently translate submitted free text.

Keep analytics unified

Aggregate by stable form, revision, field, step, and option codes. Add locale as a dimension rather than cloning event names. Low-volume locale segments can identify individuals, so apply minimum group sizes and the same retention/privacy policy as other analytics.

Cloned-per-locale forms can be a pragmatic first version, but document the cost: validation and conditional logic can drift, and conversion is split across identifiers.

Missing translations need workflow

Define one fallback chain, for example requested locale → form default → application fallback. Show editors which strings are missing before publishing. A fallback should keep the form usable, but an approval flow may block publication when legal consent text lacks translation.

Test an English/French/Arabic fixture

Our form accessibility guide explains why language metadata and understandable errors matter beyond translation. A stable multilingual model translates presentation while keeping stored semantics unchanged.

Related posts