]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/application.rb
Issue unsaved changes alerts on IE.
[rails.git] / app / controllers / application.rb
index 97332ba01eeabd25b58398450b3cd9097e3a0c64..c5624db146b4cdbfb86d03f84308c2d6f721f96e 100644 (file)
@@ -102,7 +102,16 @@ class ApplicationController < ActionController::Base
   end
   
   def set_locale
-    request.compatible_language_from(I18n.available_locales)
+    if @user
+      if !@user.languages.empty?
+        request.user_preferred_languages = @user.languages
+      elsif !request.user_preferred_languages.empty?
+        @user.languages = request.user_preferred_languages
+        @user.save
+      end
+    end
+
+    I18n.locale = request.compatible_language_from(I18n.available_locales)
   end
 
   def api_call_handle_error