Forum: Rails I18n translation of model names?

02f45974a11b1c6eb123028048bf277a?d=identicon&s=25 sean (Guest)
on 2010-12-18 20:39
(Received via mailing list)
Hi there,
I've been using I18n for a project and I've run into a problem where
it seems rails helpers (e.g. submit buttons) are not properly
translating model names, and same with validation error messages. For
example, to get a translated model name to work for the error template
header i had to use the following:
<%= I18n.t('activerecord.errors.template.header', :count =>
object.errors.size, :model =>
I18n.t("models.#{object.class.to_s.downcase}")) %>
which looks like a real kludge to my eyes.

And when I use the following for submit helpers (from the repo):

fr-CA:
  helpers:
    select:
      prompt: "Veuillez slectionner"
    submit:
      create: "Crer un %{model}"
      update: "Modifier ce %{model}"
      submit: "Enregistrer ce %{model}"

I still get the english model names, e.g. "Crer un User". Not good.

I'm using rails 3.0.3 and I've encountered these erros with both
activerecord and mongomapper.

Any ideas? Thanks in advance.

Sean
This topic is locked and can not be replied to.