Fixed browser locale issue occuring due to zh
This commit is contained in:
parent
b1936fcae9
commit
050f2dedff
|
@ -158,10 +158,14 @@ class ApplicationController < ActionController::Base
|
||||||
elsif (@site.default_locale.present? && @site.enable_language_detection.eql?(false))
|
elsif (@site.default_locale.present? && @site.enable_language_detection.eql?(false))
|
||||||
default_locale = @site.default_locale
|
default_locale = @site.default_locale
|
||||||
condition = @site.in_use_locales.include?(default_locale)
|
condition = @site.in_use_locales.include?(default_locale)
|
||||||
elsif (@site.enable_language_detection.eql?(true))
|
elsif (@site.enable_language_detection.eql?(true) && @site.default_locale.nil?)
|
||||||
#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)
|
if browser_locale.eql?("zh")
|
||||||
|
condition = @site.in_use_locales.include?("zh_tw")
|
||||||
|
else
|
||||||
|
condition = @site.in_use_locales.include?(browser_locale)
|
||||||
|
end
|
||||||
elsif (@site.default_locale.nil? && @site.enable_language_detection.eql?(false))
|
elsif (@site.default_locale.nil? && @site.enable_language_detection.eql?(false))
|
||||||
backup_locale = @site.valid_locales.first
|
backup_locale = @site.valid_locales.first
|
||||||
condition = @site.in_use_locales.include?(backup_locale)
|
condition = @site.in_use_locales.include?(backup_locale)
|
||||||
|
|
Loading…
Reference in New Issue