]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/application_controller.rb
Qualify SCALE properly - apparently object visibility when running the
[rails.git] / app / controllers / application_controller.rb
index 00104b0a174d618292cf0958c0d4c00c693e7c5a..3eefa4a9142d4d760b959799b33fb5fad0803b4a 100644 (file)
@@ -101,18 +101,20 @@ class ApplicationController < ActionController::Base
   end
   
   def set_locale
+    response.header['Vary'] = 'Accept-Language'
+
     if @user
       if !@user.languages.empty?
         request.user_preferred_languages = @user.languages
+        response.header['Vary'] = '*'
       elsif !request.user_preferred_languages.empty?
         @user.languages = request.user_preferred_languages
         @user.save
       end
     end
 
-    I18n.locale = request.preferred_language_from(I18n.available_locales) ||
-                  request.compatible_language_from(I18n.available_locales)
-    logger.info("Select #{I18n.locale} matching #{request.user_preferred_languages.join(',')} against #{I18n.available_locales.join(',')}")
+    I18n.locale = request.compatible_language_from(I18n.available_locales)
+
     response.headers['Content-Language'] = I18n.locale.to_s
   end
 
@@ -130,6 +132,8 @@ class ApplicationController < ActionController::Base
     rescue OSM::APIError => ex
       report_error ex.message, ex.status
     rescue Exception => ex
+      logger.info("API threw unexpected #{ex.class} exception: #{ex.message}")
+      ex.backtrace.each { |l| logger.info(l) }
       report_error "#{ex.class}: #{ex.message}", :internal_server_error
     end
   end