From b1936fcae92e09de4a2ba669e51cf31f86f8fec1 Mon Sep 17 00:00:00 2001 From: saurabhbhatia Date: Mon, 9 Dec 2013 12:06:19 +0800 Subject: [PATCH] Fixed backup locale and browser locale --- app/controllers/application_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 4b2a310b..275d854b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -155,10 +155,10 @@ class ApplicationController < ActionController::Base #check if the default locale is present or not elsif params[:locale] condition = @site.in_use_locales.include?(params[:locale]) - elsif @site.default_locale.present? + elsif (@site.default_locale.present? && @site.enable_language_detection.eql?(false)) default_locale = @site.default_locale condition = @site.in_use_locales.include?(default_locale) - elsif @site.enable_language_detection + elsif (@site.enable_language_detection.eql?(true)) #check enable langauge detection browser_locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first rescue nil condition = @site.in_use_locales.include?(browser_locale)