Here is my en.yml config (Rails 7)
en:
hello: "Hello world"
activerecord:
models:
user:
one: "User"
other: "Users"
attributes:
user:
first_name: "First Name"
last_name: "Last Name"
email: "Email"
role: "Role"
errors:
format: "%{message} for %{attribute}"
messages:
blank: "can't be blank"
too_short: "is too short (minimum is %{count} characters)"
I try to change the format for errors. I step in console and do
I18n.t('errors.format')
-> "%{attribute} %{message}"
Other change properly, but format dont.
format change from "%{attribute} %{message}"
to "%{message} for %{attribute}"
You're checking for I18n.t('errors.format')
, but you have it scoped under activerecord
. Move it outside of activerecord
scope:
en:
errors:
format: "%{message} for %{attribute}"
activerecord:
...
https://github.com/rails/rails/blob/v7.0.4.3/activemodel/lib/active_model/locale/en.yml#L4