Fixed backup locale and browser locale

This commit is contained in:
saurabhbhatia 2013-12-09 12:06:19 +08:00
parent 88260d59e7
commit b1936fcae9
1 changed files with 2 additions and 2 deletions

View File

@ -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)