Globalize and model error messages

Hi !
I have a probably stupid question about i18n. I started to work with
ruby-gettext, as it allows me to translate field names in model
validation messages, and thus use error_messages_for helpers. It first
worked well, but I now have some problems with it (when trying to
internationalize a hierarchy of models, with some attributes wich
doesn’t exists in the database). Gettext is nice, but seems to me more
like a ‘unix’ solution than a rails solution, so I’m open to change…

My question is here : a lot of people seems to use globalize or other
i18n plugins that, if I believe what I read, don’t support translating
models field names, table names, and error messages. So, how do you use
rails validation in yout multilingual websites. Is there another
not_too_complicated way to use rails validation, which is a great system
?

Thanx in advance,

Nicolas

On Tue, 3 Oct 2006 10:12:25 +0200
“Nicolas Noe$(D+1” [email protected] wrote:

i18n plugins that, if I believe what I read, don’t support translating
models field names, table names, and error messages. So, how do you use
rails validation in yout multilingual websites. Is there another
not_too_complicated way to use rails validation, which is a great system
?

I don’t think to detain you leave from gettext.
But I have to say, ruby-gettext has a solution to translate the
attributes
which doesn’t exists in the database.

http://www.yotabanana.com/hiki/ruby-gettext-howto-rails.html#Translate+the+attributes+which+doesn't+exist+in+your+Database

Masao M. wrote:

On Tue, 3 Oct 2006 10:12:25 +0200
“Nicolas Noe$(D+1” [email protected] wrote:

i18n plugins that, if I believe what I read, don’t support translating
models field names, table names, and error messages. So, how do you use
rails validation in yout multilingual websites. Is there another
not_too_complicated way to use rails validation, which is a great system
?

I don’t think to detain you leave from gettext.
But I have to say, ruby-gettext has a solution to translate the
attributes
which doesn’t exists in the database.

http://www.yotabanana.com/hiki/ruby-gettext-howto-rails.html#Translate+the+attributes+which+doesn't+exist+in+your+Database

Thanks !

Yeah, I already use gettext for that, and that works pretty well.
However, I had problems to use it with a hierarchy of Models (it seems
to extract direct childs of ActiveRecord::Base, but not descendents of
descendents of ActiveRecord::Base).
As I’m new to rails and have an applic to develop and maintain, I was
afraid that maybe gettext could cause other problems later and impeach
me of using all rails features…For the moment it’s ok, I found another
way to solve my problem.

Nicolas Noé wrote:

[…]

As I’m new to rails and have an applic to develop and maintain, I was
afraid that maybe gettext could cause other problems later and impeach
me of using all rails features…For the moment it’s ok, I found another
way to solve my problem.

How have You solved that problem? Have You found method to translate
fields and class names in Globalize?

bal wrote:

Nicolas Noé wrote:

[…]

As I’m new to rails and have an applic to develop and maintain, I was
afraid that maybe gettext could cause other problems later and impeach
me of using all rails features…For the moment it’s ok, I found another
way to solve my problem.

How have You solved that problem? Have You found method to translate
fields and class names in Globalize?

No, I continued to used gettext…

I’m getting into this a bit late, but Globalize was designed to handle
this. Globalize automatically tries to translate ActiveRecord
validation messages, so if you trigger a validation error, that
message should show up in the globalize_translations table and be
available for translation. Because Globalize’s string substitution
isn’t quite as sophisticated as we want it to be, it can’t translate
field names separately from the validation message. This means you
have to translate all combination of field name/validation type. In
many apps this isn’t that big a problem, but if it is in your case,
let us know. This would be a good thing to write up a ticket for.

– Josh

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs