A platform for community discussion. Free, open, simple.
FIX: Application should not crash when selected locale is missing
Gerhard Schlager683be5e5550d
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rbindex 52a94b4d3c4..479082fc6ac 100644--- a/app/controllers/application_controller.rb+++ b/app/controllers/application_controller.rb@@ -237,13 +237,15 @@ class ApplicationController < ActionController::Basedef set_localeif !current_userif SiteSetting.set_locale_from_accept_language_header- I18n.locale = locale_from_header+ locale = locale_from_headerelse- I18n.locale = SiteSetting.default_locale+ locale = SiteSetting.default_localeendelse- I18n.locale = current_user.effective_locale+ locale = current_user.effective_localeend++ I18n.locale = I18n.locale_available?(locale) ? locale : :enI18n.ensure_all_loaded!end