app/controllers/alchemy/base_controller.rb in alchemy_cms-2.7.5 vs app/controllers/alchemy/base_controller.rb in alchemy_cms-2.8.1
- old
+ new
@@ -82,55 +82,9 @@
else
::I18n.locale = request.env['HTTP_ACCEPT_LANGUAGE'].try(:scan, /^[a-z]{2}/).try(:first) || ::I18n.default_locale
end
end
- # Sets the language for rendering pages in pages controller.
- #
- def set_language(lang = nil)
- if lang
- @language = lang.is_a?(Language) ? lang : load_language_from(lang)
- else
- # find the best language and remember it for later
- @language = load_language_from_params ||
- load_language_from_session ||
- load_language_default
- end
-
- # store language in session
- store_language_in_session(@language)
-
- # switch locale to selected language
- ::I18n.locale = @language.code
- end
-
- def load_language_from_params
- if params[:lang].present?
- Language.find_by_code(params[:lang])
- end
- end
-
- def load_language_from_session
- if session[:language_id].present?
- Language.find_by_id(session[:language_id])
- end
- end
-
- def load_language_from(language_code_or_id)
- Language.find_by_id(language_code_or_id) || Language.find_by_code(language_code_or_id)
- end
-
- def load_language_default
- Language.get_default || raise(DefaultLanguageNotFoundError)
- end
-
- def store_language_in_session(language)
- if language && language.id
- session[:language_id] = language.id
- session[:language_code] = language.code
- end
- end
-
def store_location
session[:redirect_path] = request.path
end
def mailer_set_url_options