mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 09:26:54 -06:00
FIX: Application should not crash when selected locale is missing
This commit is contained in:
parent
ce060e2b86
commit
683be5e555
@ -237,13 +237,15 @@ class ApplicationController < ActionController::Base
|
||||
def set_locale
|
||||
if !current_user
|
||||
if SiteSetting.set_locale_from_accept_language_header
|
||||
I18n.locale = locale_from_header
|
||||
locale = locale_from_header
|
||||
else
|
||||
I18n.locale = SiteSetting.default_locale
|
||||
locale = SiteSetting.default_locale
|
||||
end
|
||||
else
|
||||
I18n.locale = current_user.effective_locale
|
||||
locale = current_user.effective_locale
|
||||
end
|
||||
|
||||
I18n.locale = I18n.locale_available?(locale) ? locale : :en
|
||||
I18n.ensure_all_loaded!
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user