Hey everyone,
I am replacing some old Rails model localization with Globalize2. I am
really impressed with the design of the Globalize2 plugin, but we have a
pretty involved i18n setup on my site, so I’m finding a lot of areas to
improve. So far I have a number of significant changes in my github
fork:
http://github.com/dasil003/globalize2
- translates accepts a block to customize the dynamicly generated
Translation class (thanks juni0r) - some options to allow multiple models to use the same translation
table (:foreign_key and :not_dependent) - add a unique key to enforce translation uniqueness and speed up
queries collecting all translations for a given language - dynamic locale-specific accessors. this allows bypassing fallbacks,
is easier to code forms against then #set_translations, and is more
robust then accepts_nested_attributes solutions which are subject to
race conditions and dups due to the fact that there is no lookup by
unique key other than an actual translation primary_key.
Now I’m onto some more involved questions such as how to handle
validations on the translation model and pass it back to the base model
without the current exceptions we see when translation saves fail, and
also the issue of deleting translations (eg. auto-clearing translations
when there is no data in them).
As I mentioned my app is quite complex in its localization architecture.
I am writing my enhancements to be general purpose and well-tested, but
could use some input from others using globalize2 to increase the chance
that the stuff I’m working on can make it back into the mainline and be
useful to others.
One example of a big issue I’d like to collaborate on is how to test
I18n.fallbacks in Globalize2 (which currently have tests that don’t run,
and are broken when I explicitly enable fallbacks). Another thing is a
test harness for I18n.available_locales, or supporting per-Globalize
available_locales setting (rather than implicitly defining from the DB).
Anyone down to work on this?