fix for default locale
This commit is contained in:
parent
87c3090784
commit
88260d59e7
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue