=== NOTE: The localize method has been changed from localize to localized in version 1.1.2
---
{}[https://codeclimate.com/github/mattways/rails_i18n_routes] {}[https://travis-ci.org/mattways/rails_i18n_routes] {}[https://gemnasium.com/mattways/rails_i18n_routes]
= Rails I18n Routes
Minimalistic toolkit to handle i18n routes and detect locale from subdomain or prefix.
= Install
Put this line in your Gemfile:
gem 'rails_i18n_routes'
Then bundle:
$ bundle
= Usage
Choose how the language would be selected in your application.rb...
To use prefix (default):
config.i18n_routes.selection = :prefix
To use subdomain:
config.i18n_routes.selection = :subdomain
config.i18n_routes.mapping = {
:es => [:ar, :uy]
:pt => [:br]
}
In the case of subdomains you need to name the yml file in your locales dir using this format:
es-UY.yml
es-AR.yml
pt-BR.yml
Inside each yaml file:
es-UY:
routes:
users: "usuarios"
profile: "perfil"
login: "entrar"
(Please note each part of the path it's translated individually, you don't have to put translations for paths like "users/1/profile" just translate "users" and "profile", the plugin will do the rest)
Finally in your routes.rb pass the routes you want to be localized to localize method:
localized do
math 'contact' => 'static#contact', :as => 'contact'
end