localization-middleware

The gem that allows to manipulate I18n.locale via url.

Usage

  • First install the gem

    With Bundle

    #Gemfile
    gem "padrino-localization"
    
    #irb
    bundle install
    

    or with gem

    gem install padrino-localization
    
  • Now it should be added to middleware(Padrino example)

    Padrino.use(Localization::Middleware, __DEFINE_HERE_LOCALES__)
    
    # config/apps.rb
    Padrino.use(Localization::Middleware, %w(en ru))
    
  • And that’s it. You now can access your application via /page_path, /en/page_path or /ru/page_path

(in case you specified only tow locales: russian ang english). If no locale was defined, then the I18n.default_locale will be used.

Copyright © 2012 kot-begemot. See LICENSE.txt for further details.