I have this on my rails.pt-BR.yml:
br:
errors:
format: ! '%{attribute} %{message}'
messages:
restrict_dependent_destroy:
one: "Não é possível excluir o registro pois existe um %{record} dependente"
many: "Não é possível excluir o registro pois existem %{record} dependentes"
In my model, I have this:
has_many :entities, dependent: :restrict_with_error
Whenever restrict_dependent_destroy is triggered, %{record} is showing the model name (plural) in english, and is not being translated, like this: "Não é possível excluir o registro pois existem entities dependentes".
I have another file that contains the translation for :entities
br:
activerecord:
models:
entities: 'entidades'
Where do rails get the translation for %{record}? Am I missing something here?
Thanks in advance!
This is a bug in :restrict_with_error
message (https://github.com/rails/rails/pull/10787).
As a workaround you can use:
br:
activerecord:
attributes:
entity: # Should be the parent class when bug https://github.com/rails/rails/pull/10787 is fixed
entities: 'entidades'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With