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
|
#check enable langauge detection
|
||||||
browser_locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first rescue nil
|
browser_locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first rescue nil
|
||||||
condition = @site.in_use_locales.include?(browser_locale)
|
condition = @site.in_use_locales.include?(browser_locale)
|
||||||
elsif (@site.default_locale.nil? && @site.enable_language_detection.eql?(false) && session[:locale].nil?)
|
elsif (@site.default_locale.nil? && @site.enable_language_detection.eql?(false))
|
||||||
session[:locale] = @site.valid_locales.first
|
backup_locale = @site.valid_locales.first
|
||||||
condition = @site.in_use_locales.include?(params[:locale])
|
condition = @site.in_use_locales.include?(backup_locale)
|
||||||
end
|
end
|
||||||
|
|
||||||
session[:locale] = condition ? ( session[:locale] || default_locale || browser_locale || backup_locale) : I18n.default_locale.to_s
|
session[:locale] = condition ? ( session[:locale] || default_locale || browser_locale || backup_locale) : I18n.default_locale.to_s
|
||||||
|
|
Reference in New Issue