Sha256: 072e7e7c951ed44634297bd268f27421ce4453a1c97feb56c2b073fb56e15e37

Contents?: true

Size: 1.52 KB

Versions: 1

Compression:

Stored size: 1.52 KB

Contents

{<img src="https://badge.fury.io/rb/translatable_routes.png" alt="Gem Version" />}[http://badge.fury.io/rb/translatable_routes] {<img src="https://codeclimate.com/github/museways/translatable_routes.png" />}[https://codeclimate.com/github/museways/translatable_routes] {<img src="https://travis-ci.org/museways/translatable_routes.png?branch=master" alt="Build Status" />}[https://travis-ci.org/museways/translatable_routes]

= Translatable Routes

Minimalistic toolkit to translate routes in rails.

= Install

Put this line in your Gemfile:
  gem 'translatable_routes'

Then bundle:
  $ bundle
 
= Configuration

In your config/routes.rb use the localized method to decide wich routes will be localized:
  localized do
    get 'about' => 'pages#about'
  end

Put your translations inside the routes key in your locales yamls:
  es:
    routes:
      users: "usuarios"
      profile: "perfil"
      about: "nosotros"

NOTE: There is no need to put the full path, just translate each part individually.

= Usage

Helpers will continue working the same but I18n.locale will be use as default locale:
  about_path # Will output /en/about in case I18n.locale is :en

Here is an example of what you may want to add to your controllers to select the current locale:
  before_action :select_locale

  protected

  def select_locale
    I18n.locale = params[:locale]
  end

= Credits

This gem is maintained and funded by museways[http://museways.com].

= License

It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
translatable_routes-1.3.3 README.rdoc