Skip to content

Developers · Pages and Layouts

System Messages

Last updated 1 November 2026

This document describes internationalising form errors, authorization policies, and other system messages.

Form validation messages

You can provide messages that the system will apply to different validation errors in other languages. Special variables are available inside the translation keys to make your messages look complete.

Always available:

  • record: resource name, e.g.
  • attribute: attribute name, e.g.
  • value: the value of an attribute provided by the user which failed validation, e.g.

Contextual

  • count: available in cases with a numeric limit/range, for example, 180 characters passed in a field with a character limit of 140.

The default error messages are:

en:
  errors:
    format: "%{attribute} %{message}"
    messages:
      record_invalid: "Validation failed: %{errors}"
      inclusion: "is not included in the list"
      exclusion: "is reserved"
      invalid: "is invalid"
      confirmation: "doesn't match %{attribute}"
      accepted: "must be accepted"
      empty: "can't be empty"
      blank: "can't be blank"
      present: "must be blank"
      too_long:
        one: "is too long (maximum is 1 character)"
        other: "is too long (maximum is %{count} characters)"
      too_short:
        one: "is too short (minimum is 1 character)"
        other: "is too short (minimum is %{count} characters)"
      wrong_length:
        one: "is the wrong length (should be 1 character)"
        other: "is the wrong length (should be %{count} characters)"
      not_a_number: "is not a number"
      not_an_integer: "must be an integer"
      greater_than: "must be greater than %{count}"
      greater_than_or_equal_to: "must be greater than or equal to %{count}"
      equal_to: "must be equal to %{count}"
      less_than: "must be less than %{count}"
      less_than_or_equal_to: "must be less than or equal to %{count}"
      other_than: "must be other than %{count}"
      odd: "must be odd"
      even: "must be even"

To override these messages, create your file in the folder or your module directory.

You can override only one message.

app/translations/en.yml

en:
  errors:
    messages:
      empty: "%{attribute} cannot be empty"
      blank: "Please fill in %{attribute}"

Authorization policies

You can also use translations to internationalise the property in authorization policies.

app/authorization_policies/always_fail.liquid

---
name: always_fail
flash_alert: "{{ 'access.fail' | t }}"
redirect_to: /multilanguage-unauthorized
---
false

app/views/pages/unauthorized.liquid

---
slug: multilanguage-unauthorized
authorization_policies:
- always_fail
---

app/translations/en.yml

en:
  access:
    fail: You do not have permission to access this page.

app/translations/pl.yml

pl:
  access:
    fail: Nie masz dostępu do tej strony.