Orbit/vendor/built_in_modules/personal_conference/app/controllers/application_controller.rb

24 lines
573 B
Ruby

class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :set_locale
# Set I18n.locale
def set_locale
# update session if passed
session[:locale] = params[:locale] if params[:locale]
# set locale based on session or default
begin
# check if locale is valid for non site pages
if !VALID_LOCALES.include?(session[:locale])
I18n.locale = I18n.default_locale
else
I18n.locale = session[:locale]
end
rescue
I18n.locale = I18n.default_locale
end
end
end