I have been using an date picker control, if some one enters text instead of date then there is custom massage that i want to show, I have done it with English language but i am unable to translate it. I have put its translation in fr.yml file but it cant work.
Let me show you my code
invoice.rb **
base.validates_date :due_date, :allow_nil => true
def validates_date(*args)
options = temporal_validation_options({ :message => _("is an invalid date") }, args)
.
.
record.errors.add(args, options[:message])
end
**
The string "is an invalid date" get translat开发者_Python百科ed that i done in fr.po file but the word "Due date" also get attached with it and remain untranslated.
I tried to resolve it in my fr.yml file by the following code
fr.yml
activerecord:
errors:
models:
invoice:
attributes:
invoice:
due_date: "date d'échéance"
but what i am getting when i switch to french version is
"Due date est une date invalide " while it should be "date d'échéance est une date invalide "
I think the errors
is not needed and you have to indent the due_date
:
fr:
activerecord:
models:
invoice: "la facture"
attributes:
invoice:
due_date: "date d'échéance"
精彩评论