Ruby Forum Rails I18n > Gettext's Locale class in application namespace

Posted by Samuel Lown (samlown)
on 23.10.2007 12:14
Hi,

I've been trying to use Gettext with one my web applications. I've used
Gettext many times in the past without problems and appreciate it
greatly. In this particular instance, my web application has its own
ActiveRecord Locale model which I use to store the locales the
application will support. (I prefer to use Locale for the user
interface, and Language for the language a model is available in; a
subtle but important difference.)

The problem with Gettext in this situation however, is that it provides
its own Locale class in the application namespace instead of something
like Gettext::Locale. This conflicts with my Locale model, preventing
things from working.

Globalize also provides its own Locale class, but sensibly inside the
Globalize module's namespace, i.e. Globalize::Locale so that it doesn't
cause any problems.

I would like to ask for any opinions on this matter, to see if anyone
else agrees that Gettext's Locale *should* be inside the Gettext module.
I'd also be interested in any recommendations for alternative methods,
other than renaming my Locale model to something else which is the most
obvious!

Thanks in advance,
Cheers,
Sam Lown
Posted by Samuel Lown (samlown)
on 28.10.2007 11:58
For the moment, I've converted my own Locale model into SystemLocale so 
that it does not conflict with the interests of Gettext. Not the ideal 
situation IMHO, but it will suffice.

Cheers, sam