0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-09-18 23:01:11 +02:00

FIX: adopt a simplified with_resolved_locale to ensure user's locale is always loaded

Dieser Commit ist enthalten in:
Angus McLeod 2022-07-15 13:23:32 +01:00
Ursprung d64b6b50dd
Commit 0b3c71c621

Datei anzeigen

@ -12,6 +12,7 @@ class CustomWizard::WizardController < ::ActionController::Base
before_action :preload_wizard_json
before_action :ensure_plugin_enabled
before_action :ensure_logged_in, only: [:skip]
around_action :with_resolved_locale
helper_method :wizard_page_title
helper_method :wizard_theme_id
@ -115,6 +116,13 @@ class CustomWizard::WizardController < ::ActionController::Base
@preloaded[key] = json.gsub("</", "<\\/")
end
## Simplified version of with_resolved_locale in ApplicationController
def with_resolved_locale
locale = current_user ? current_user.effective_locale : SiteSetting.default_locale
I18n.ensure_all_loaded!
I18n.with_locale(locale) { yield }
end
private
def ensure_plugin_enabled