Forum: Rails I18n globalize2 - virtual attributes to access field in a specific language directly

Posted by hydrozen (Guest)
on 2010-01-14 05:09
(Received via mailing list)
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...
Posted by Henrik --- (malesca)
on 2010-01-14 09:38
(Received via mailing list)
On Thu, Jan 14, 2010 at 05:08, hydrozen <hydrozen@gmail.com> 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/
Posted by Sven Fuchs (Guest)
on 2010-01-17 16:05
(Received via mailing list)
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?
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.