Forum: Rails I18n Error trying to translate a model name in a validation message

7726049d909dcfc4bf06f7dbfade29e2?d=identicon&s=25 Dave Christiansen (Guest)
on 2009-11-04 17:11
(Received via mailing list)
So far I've found internationalization with Rails to be a very pleasant
experience. But I've run into trouble trying to translate model names
and I need a little help.

Here's my fr.yml:
fr:
activerecord:
models:
person: Personne
attributes:
last_name: "Nom de Famille"

Please forgive me if the French is bad - I'm just using it as a
bootstrap example and it's not an official translation.

Last name is a required field and when I try to save I get this error:

translation data {:person=>"Personne"} can not be used with :count => 1

And here's some more information from Rails:



Extracted source (around line #28 ): 25:
26: <% content_for :title do %>
27:   Edit Morbidity Event: <%= h(patient_name) %>
28: <% end %>
29:
30: <% content_for :tools_two do %>
31:   <%= save_buttons(@event) %>


RAILS_ROOT: /home/david/trisano-ee/webapp Application Trace | Framework
Trace | Full Trace
/home/david/trisano-ee/webapp/vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:139:in
`pluralize'
/home/david/trisano-ee/webapp/vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:40:in
`translate'
/home/david/trisano-ee/webapp/vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb:165:in
`t'
/home/david/trisano-ee/webapp/vendor/rails/actionpack/lib/action_view/helpers/active_record_helper.rb:197:in
`error_messages_for'
/home/david/trisano-ee/webapp/vendor/rails/activesupport/lib/active_support/core_ext/object/misc.rb:78:in
`with_options'
/home/david/trisano-ee/webapp/vendor/rails/actionpack/lib/action_view/helpers/active_record_helper.rb:192:in
`error_messages_for'
/home/david/trisano-ee/webapp/app/views/morbidity_events/edit.html.erb:28:in
`_run_erb_app47views47morbidity_events47edit46html46erb'
/home/david/trisano-ee/webapp/app/controllers/morbidity_events_controller.rb:141:in
`update'
/home/david/trisano-ee/webapp/app/controllers/morbidity_events_controller.rb:123:in
`update'

Anybody have any ideas what's going on?

Thanks in advance for the help .

Dave Christiansen
Senior Developer
Collaborative Software Initiative
503-545-5350 (CSI TriSanoâ„¢ Support)
317-966-6154 (personal)
dave@csinitiative.com
This topic is locked and can not be replied to.