Class: Spree::LocaleController

Inherits:
BaseController show all
Defined in:
app/controllers/spree/locale_controller.rb

Instance Attribute Summary

Attributes included from Core::ControllerHelpers

#title

Instance Method Summary collapse

Methods included from Core::ControllerHelpers

#access_forbidden, included

Instance Method Details

#setObject



3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/controllers/spree/locale_controller.rb', line 3

def set
  if request.referer && request.referer.starts_with?('http://' + request.host)
    session['user_return_to'] = request.referer
  end
  if params[:locale] && I18n.available_locales.include?(params[:locale].to_sym)
    session[:locale] = I18n.locale = params[:locale].to_sym
    flash.notice = t(:locale_changed)
  else
    flash[:error] = t(:locale_not_changed)
  end
  redirect_back_or_default(root_path)
end