photomix/app/controllers/locale_controller.rb

17 lines
546 B
Ruby
Raw Normal View History

2012-07-24 23:26:16 +02:00
class LocaleController < ApplicationController
2012-07-29 00:33:03 +02:00
skip_before_filter :authenticate_user!, :only => [:set]
2012-07-24 23:26:16 +02:00
def set
if request.referer && request.referer.starts_with?('http://' + request.host)
session['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
end