Globalize2 - virtual attributes to access field in a specific language directly

Hi,

I just did a small extension to the translates method of globalize2 so
that it defines a couple additional attributes to my model. For
example, since my application supports french and english, when I do
translates :title in my model, it generates the title method but also
title_en and title_fr to access to access each language without
manually switching I18n.locale back and forth.

I am just wondering if you guys think it can be a good idea. It seems
to simplify the development of my forms IMHO. I could package it and
release it into the wild…

On Thu, Jan 14, 2010 at 05:08, hydrozen [email protected] wrote:

to simplify the development of my forms IMHO. I could package it and
release it into the wild…

Sounds very handy. Best way to release would probably be to fork
globalize2 on GitHub: http://github.com/joshmh/globalize2/

On Jan 14, 2010, at 5:08 AM, hydrozen wrote:

I just did a small extension to the translates method of globalize2 so
that it defines a couple additional attributes to my model. For
example, since my application supports french and english, when I do
translates :title in my model, it generates the title method but also
title_en and title_fr to access to access each language without
manually switching I18n.locale back and forth.

I am just wondering if you guys think it can be a good idea. It seems
to simplify the development of my forms IMHO. I could package it and
release it into the wild…

Sounds like something that already has been implemented twice:

http://github.com/astropanic/easy_globalize2_accessors
http://github.com/bsamman/globalize2-easy-translate

Are you one of the authors?

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