Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-09 20:02:54 +01:00
FIX: adopt a simplified with_resolved_locale to ensure user's locale is always loaded
Dieser Commit ist enthalten in:
Ursprung
d64b6b50dd
Commit
0b3c71c621
1 geänderte Dateien mit 8 neuen und 0 gelöschten Zeilen
|
@ -12,6 +12,7 @@ class CustomWizard::WizardController < ::ActionController::Base
|
||||||
before_action :preload_wizard_json
|
before_action :preload_wizard_json
|
||||||
before_action :ensure_plugin_enabled
|
before_action :ensure_plugin_enabled
|
||||||
before_action :ensure_logged_in, only: [:skip]
|
before_action :ensure_logged_in, only: [:skip]
|
||||||
|
around_action :with_resolved_locale
|
||||||
|
|
||||||
helper_method :wizard_page_title
|
helper_method :wizard_page_title
|
||||||
helper_method :wizard_theme_id
|
helper_method :wizard_theme_id
|
||||||
|
@ -115,6 +116,13 @@ class CustomWizard::WizardController < ::ActionController::Base
|
||||||
@preloaded[key] = json.gsub("</", "<\\/")
|
@preloaded[key] = json.gsub("</", "<\\/")
|
||||||
end
|
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
|
private
|
||||||
|
|
||||||
def ensure_plugin_enabled
|
def ensure_plugin_enabled
|
||||||
|
|
Laden …
In neuem Issue referenzieren