[Rails-core] Localization ideas/proposal

Kyle Maxwell
Tue, 08 Nov 2005 06:33:21 -0000

I''m definitely open to other ideas on ActiveRecord localization.
I''m
not sure what you find strange about the suggested idea.  Perhaps it
is that you are "locked" into your current locale?

I think that if we are going to do database localization in Rails,
then we will have a LocalizedModel belongs_to :locale situation.  That
seems obvious to me (please tell me if you think I''m wrong).  The
locale table can be either an actual table, or a fixture (I think I
prefer the latter).

Now then, the question is "what methods do we provide to interface
with this data model?"  Whatever methods we choose should (IMHO)
accommodate both a complete view of the database ("normal mode"), and
a view where one can only interact with data in a specific locale
("localized mode").  It is beneficial to make both paradigms as easy
and straightforward as possible.

In thinking about it over the last several hours, it is perhaps not
ideal to override Model.find with Locale.current.models.find, as that
diminishes the normal mode capabilities.  On the other hand, prefixing
Locale.current. to every find may be tedious, and I anticipate that
localized mode will be used in the (vast?) majority of circumstances.

Idea: Use _Model to represent a localized model (i.e.
_Model.find(...)).  This has the benefit of looking something like
gettext, and it doesn''t change the default functionality.

I haven''t quite reached a conclusion yet as to the interface to the
localized data model.  Please keep the feedback coming!

Kyle Maxwell

On 11/7/05, Ioan Bizau <ionut.bizau@gmail.com>
wrote:
>
>  I find Kyle''s idea great! That''s how .NET does it
(except the model part)
> and it seems the most natural way to go. The ActiveRecord localization
> sounds a bit strange, but it wouldn''t mind if implemented as an
"acts_as".
>
> _______________________________________________
> Rails-core mailing list
> Rails-core@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-core
>
>
>