added user setting to set_locale

This commit is contained in:
Manuel Wiedenmann 2013-06-07 19:05:28 +02:00
parent 0061e45198
commit c8c810a0a4

View file

@ -12,6 +12,10 @@ module Foodsoft
params[:locale] params[:locale]
end end
def user_settings_language
current_user.settings.profile['language'] if current_user
end
def session_language def session_language
session[:locale] session[:locale]
end end
@ -27,7 +31,7 @@ module Foodsoft
protected protected
def select_language_according_to_priority def select_language_according_to_priority
language = explicitly_requested_language || session_language || browser_language language = explicitly_requested_language || session_language || user_settings_language || browser_language
language.to_sym unless language.blank? language.to_sym unless language.blank?
end end