No commit activity in last 3 years
No release in over 3 years
Easy locale change for Spree
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

##Spree Change Locale

Build Status

Easy locale change in Spree.

##Install

Add the following to your Gemfile

gem 'spree_change_locale'

Or if you want to use edge: gem 'spree_change_locale', :git => 'git://github.com/humancopy/spree-change-locale.git'

Run:

bundle install

##Example

Adds a locale controller and route so then any path can be prepended with the locale.

The extension saves the locale in session[:locale] and redirects the user back to the requested page, omitting the locale from the path.

Examples:

  • /es/cart => /cart in Spanish
  • /fr/account => /account in French
  • /ru => / in Russian.

Look at examples/_language_bar.html.erb for a simple use in views.

By default the extension will look at config/locales for enabled locales. If none found, it will try to look at I18n.available_locales. If still no array of enabled locales can be constructed, it will use a single locale as defined by I18n.default_locale.

You can define Spree::Config[:enabled_locales] with an array of enabled locales to force. (e.g. Spree::Config.set(:enabled_locales, ['en','es','it']))

Testing

Be sure to add the rspec-rails gem to your Gemfile and then create a dummy test app for the specs to run against.

$ bundle exec rspec spec

Copyright (c) 2011 humancopy.net, released under the New BSD License