I’m working for the first time on a project that uses the Globalize Rails plugin. It rocks. It’s about as close to an unobtrusive I18N/L10N framework as it gets. I’ve used a couple of approaches before, both self-written and third party, but they don’t get even close to the ease of deployment with Globalize.
There is one gotcha with Globalize, though, which is probably worth sharing: it overwrites Rails code. This isn’t such a surprise since runtime extensibility is one of the founding Ruby principles. It does, however, break the backwards-compatibility.
One specific thing that bit me was that after starting to use Globalize, assert_template didn’t work anymore. Suddenly it started to get the whole path for the template, as opposed to relative from the template root which is the default Rails behaviour. So assertions like
assert_template “admin/books/new”
won’t work anymore. You could of course put the absolute path in your assertion but that would break the portability of the app. I guess it would work with constants like RAILS_ROOT, but using it in every assert_template call would be just plain ugly.
There is a pending patch in Rails Trac to accept regexps as assert_template arguments, which would make the problem go away, but until it gets applied to the trunk, I’ll just comment out the assert_template calls.