http://www.agilewebdevelopment.com/plugins/localization_simplified
I don't see a way of overriding the model field names. instead, just build your own error_messages_for method as a application helper.
just have a look at the source of error_messages_for() in the API docs, its really simple. and instead of using the model field names, include the translated name in the validation message like : validates_length_of :last_name, :maximum=>30, :message=>"Last Name has to be less than %d"
your own error_messages_for() in y<our ApplicationHelper could look something like this:
e.g. (very simple example):
def my_error_messages_for(object) message = String.New object.errors.each do |attr,msg| message << "#{msg}<br />\n" end message end
(attr would be the model field name producing the error, msg would be the message set with :message in the validation)
Nic wrote in post #209083:
http://www.agilewebdevelopment.com/plugins/localization_simplified
This simple localization is great, but it still uses my english model field names in validation error messages. Any way of overriding those?
It is possible, but I don't remember how off the top of my head. There's been some discussion of this before, so if you search the list archives, you'll probably find what you need.
TIA Nick
Best,
This simple localization is great, but it still uses my english model
field names in validation error messages. Any way of overriding those?
elmer.yml
activerecord: errors: models: rabbit: wabbit
attributes:
rescription: descwiption
language: wanguage
Radhames Brito wrote in post #956359:
This simple localization is great, but it still uses my english model
> field names in validation error messages. Any way of overriding those?
elmer.yml
activerecord: errors: models: rabbit: wabbit attributes: rescription: descwiption language: wanguage
Gweat example!
Best,