Skip to content

A platform for community discussion. Free, open, simple.

DEV: adds unregister_locale (#32676)

Joffrey JAFFEUXda111d87bd84
diff --git a/lib/discourse_plugin_registry.rb b/lib/discourse_plugin_registry.rb
index 470104009f2..bc2e55c8ae4 100644
--- a/lib/discourse_plugin_registry.rb
+++ b/lib/discourse_plugin_registry.rb
@@ -168,6 +168,12 @@ class DiscoursePluginRegistry
self.locales[locale] = options
end
+ def self.unregister_locale(locale)
+ raise "unregister_locale can only be used in tests" if !Rails.env.test?
+
+ self.locales.delete(locale)
+ end
+
def register_archetype(name, options = {})
Archetype.register(name, options)
end
diff --git a/spec/lib/freedom_patches/translate_accelerator_spec.rb b/spec/lib/freedom_patches/translate_accelerator_spec.rb
index 0c9d3ac0c60..3d64d914ae0 100644
--- a/spec/lib/freedom_patches/translate_accelerator_spec.rb
+++ b/spec/lib/freedom_patches/translate_accelerator_spec.rb
@@ -110,7 +110,7 @@ RSpec.describe "translate accelerator" do
end
after do
- DiscoursePluginRegistry.reset!
+ DiscoursePluginRegistry.unregister_locale("foo")
LocaleSiteSetting.reset!
end