24
Validation

Validation Localization

Translate validation messages with runtime locale selection and custom language support.

FormForge translates messages while keeping technical keys stable in English.

  • only messages are translated
  • error keys remain unchanged

Configuration:

  • validation.locale
  • validation.fallback_locale
  • validation.supported_locales
  • validation.allow_request_locale
  • validation.locale_query_param (default: formforge_locale)
  • validation.locale_header (default: X-FormForge-Locale)

Runtime locale priority:

  1. explicit locale argument in method call
  2. request query/header (if enabled)
  3. FormForge config locale
  4. app locale
  5. FormForge fallback locale

Add your own language

  1. php artisan vendor:publish --tag=formforge-lang
  2. copy lang/vendor/formforge/en to your locale folder
  3. translate message strings only
  4. keep technical keys unchanged
  5. add the locale to validation.supported_locales

If a locale/key is missing, FormForge falls back to validation.fallback_locale.