Forum: Rails I18n translation of model names?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
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):

      prompt: "Veuillez slectionner"
      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.

This topic is locked and can not be replied to.