]> git.openstreetmap.org Git - rails.git/commitdiff
Try preferred_language_from as it looks for an exact match - only if that
authorTom Hughes <tom@compton.nu>
Wed, 15 Jul 2009 23:29:07 +0000 (23:29 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 15 Jul 2009 23:29:07 +0000 (23:29 +0000)
fails do we fall back to compatible_language_from which will take any
language where the first token matches. Fixes #2069.

app/controllers/application_controller.rb

index 0d6cdea6424fea77b93e32e047796546008a1637..00104b0a174d618292cf0958c0d4c00c693e7c5a 100644 (file)
@@ -110,8 +110,9 @@ class ApplicationController < ActionController::Base
       end
     end
 
-    I18n.locale = request.compatible_language_from(I18n.available_locales)
-
+    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(',')}")
     response.headers['Content-Language'] = I18n.locale.to_s
   end