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

A4fa2e5a04dfad8b71cd83c8becb42a3?d=identicon&s=25 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...
4a551074ddba4460f95d011c47190d0e?d=identicon&s=25 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/
402602a60e500e85f2f5dc1ff3648ecb?d=identicon&s=25 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?
This topic is locked and can not be replied to.