fix for default locale

This commit is contained in:
saurabhbhatia 2013-12-09 11:10:55 +08:00
parent 87c3090784
commit 88260d59e7
1 changed files with 3 additions and 3 deletions

View File

@ -162,9 +162,9 @@ class ApplicationController < ActionController::Base
#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)
elsif (@site.default_locale.nil? && @site.enable_language_detection.eql?(false) && session[:locale].nil?)
session[:locale] = @site.valid_locales.first
condition = @site.in_use_locales.include?(params[:locale])
elsif (@site.default_locale.nil? && @site.enable_language_detection.eql?(false))
backup_locale = @site.valid_locales.first
condition = @site.in_use_locales.include?(backup_locale)
end
session[:locale] = condition ? ( session[:locale] || default_locale || browser_locale || backup_locale) : I18n.default_locale.to_s