I don't manage to change the default error message from simple form, i tried to edit the simple form locale file but it seems to be ignored
Here is my locale file :
#config/locales/simple_form.en.yml
en:
simple_form:
error_notification:
default_message: "A custom message:"
But i still get "Please review the problems below:"
Does anybody knows what i'm doing wrong ?
Change your :default_message
to :your_model_name
As you can see in the source, error_notification
method uses translate_error_notification
to get translation from YAML file.
def translate_error_notification
lookups = []
lookups << :"#{object_name}"
lookups << :default_message
lookups << "Please review the problems below:"
I18n.t(lookups.shift, scope: :"simple_form.error_notification", default: lookups)
end
For user
model lookups
contains:
lookups == [:user, :default_messge, "Please review the problems below:]
Translation could be differrent for each object so this transaction is called:
#config/locales/simple_form.en.yml
en:
simple_form:
error_notification:
user: "A custom message:"
Vote if it'll help ;)
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