From 1368f194da3834559c195e6a9e269cd4cb580437 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Wed, 15 Jul 2009 23:29:07 +0000 Subject: [PATCH] Try preferred_language_from as it looks for an exact match - only if that 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0d6cdea64..00104b0a1 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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 -- 2.43.2