diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 18f33a2c0..a950b9353 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -153,15 +153,15 @@ class ApplicationController < ActionController::Base if LIST[:forbidden_item_names].include?(env['PATH_INFO'].split('/')[1].to_s) condition = VALID_LOCALES.include?(session[:locale]) #check if the default locale is present or not - elsif session[:locale] - condition = @site.in_use_locales.include?(session[:locale]) + elsif params[:locale] + condition = @site.in_use_locales.include?(params[:locale]) + elsif @site.default_locale.present? + default_locale = @site.default_locale + condition = @site.in_use_locales.include?(default_locale) elsif @site.enable_language_detection #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.present? - default_locale = @site.default_locale - condition = @site.in_use_locales.include?(default_locale) end session[:locale] = condition ? (browser_locale || session[:locale] || default_locale) : I18n.default_locale.to_s diff --git a/app/views/front/show_page_sub_menu.html.erb b/app/views/front/show_page_sub_menu.html.erb index 58b1ceaa7..bb6d3d9f3 100644 --- a/app/views/front/show_page_sub_menu.html.erb +++ b/app/views/front/show_page_sub_menu.html.erb @@ -14,7 +14,7 @@