Rails i18n with Routed Locales
Localizing and globalizing Rails apps has gotten much easier with version 2.2. Add model translations with Globalize2 and you’re on your way. But where to store the locale? The session is a big no no, so it would be more elegant to just prepend them to the path and adjust the routes accordingly:
Rails routing is arcane and difficult, so hacking away at it is like stumbling into a mine field. Especially difficult is the preservation of url_helpers, so Sven Fuchs decided to wrap the whole blob with a routing filter whose sample implementation is in:
and now works out of the box, so there’s no need for you to hack your own filter module as it might appear reading the docs.
Posted: 10 December 2008