I18n_routing is a plugin for Ruby on Rails that lets you easily translate your routes trough the I18n api included in Rails since version 2.2
Works with : resources, resource and named_routes (or Rails3 match)
Note: This plugin does not provide any url locale recognition, it just deserve its main purpose: translate your rails routes. You need to find your own way for setting the current locale (checking the domain or the subdomain for example !)
For any question, use the i18_routing google group
First, declare a localized resources in your routes.rb :
localized do resources :users end
Then, translate your resources in your locales files (if you are using the simple Backend, or anywhere else depending on your I18n backend):
fr: resources: users: 'utilisateurs'
After that, when you will use any users route helpers in your app, it will transparently use the correct route path depending on your current locale.
$ rails console ruby-1.8.7-p249 > I18n.locale = :en => :en ruby-1.8.7-p249 > app.users_path => "/users" ruby-1.8.7-p249 > I18n.locale = :fr => :fr ruby-1.8.7-p249 > app.users_path => "/utilisateurs" ruby-1.8.7-p249 >
Be careful when running Rails 2.3 with the shipped i18n gem: this is an old i18n version and i18_routing will install the latest i18n version as a gem.
This latest version may be incompatible with some old usages.
Furthermore, if the i18n gem is present on your system, Rails will load it and skip the shipped version; Keep that in mind.
Last edited by kwi,