Sha256: 87d6923192ace68f2f4d609ccdbb1bcf84c2d328c3af3bde23b463f4f501be8b

Contents?: true

Size: 1.61 KB

Versions: 3

Compression:

Stored size: 1.61 KB

Contents

=== NOTE: The localize method has been changed from localize to localized in version 1.1.2

---

{<img src="https://codeclimate.com/github/mattways/rails_i18n_routes.png" />}[https://codeclimate.com/github/mattways/rails_i18n_routes] {<img src="https://secure.travis-ci.org/mattways/rails_i18n_routes.png?branch=master" alt="Build Status" />}[https://travis-ci.org/mattways/rails_i18n_routes] {<img src="https://gemnasium.com/mattways/rails_i18n_routes.png" alt="Dependency Status" />}[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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails_i18n_routes-1.1.9 README.rdoc
rails_i18n_routes-1.1.8 README.rdoc
rails_i18n_routes-1.1.6 README.rdoc