localyzed 0.0.3.8 → 0.0.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,12 +11,12 @@ module Localyzed::LocalyzedController
|
|
11
11
|
|
12
12
|
# sets the locale by checking user data then request param then session data then retrieving accept language data
|
13
13
|
def set_locale
|
14
|
-
cl = ( ( respond_to?(:user_signed_in?) && current_user.try(:respond_to?,:language) ) ? current_user.language : 'en')
|
14
|
+
cl = ( ( respond_to?(:user_signed_in?) && current_user.try(:user_profile).try(:respond_to?,:language) ) ? current_user.user_profile.language : 'en')
|
15
15
|
if params[:locale].nil? and user_signed_in? and cl and I18n.available_locales.include?(cl)
|
16
16
|
locale = I18n.locale = cl
|
17
17
|
session[:locale] = locale
|
18
18
|
else
|
19
|
-
current_user.try(:update_attributes,{:language => params[:locale]}) if params[:locale] && cl.try(:!=, params[:locale])
|
19
|
+
current_user.try(:user_profile).try(:update_attributes,{:language => params[:locale]}) if params[:locale] && cl.try(:!=, params[:locale])
|
20
20
|
define_locale
|
21
21
|
end
|
22
22
|
end
|
data/lib/localyzed/version.rb
CHANGED