DEV: Remove patch for I18n.exists?

DEV: Remove patch for I18n.exists?

It was merged upstream a long time ago

diff --git a/lib/freedom_patches/translate_accelerator.rb b/lib/freedom_patches/translate_accelerator.rb
index 593e9d1..ea43dac 100644
--- a/lib/freedom_patches/translate_accelerator.rb
+++ b/lib/freedom_patches/translate_accelerator.rb
@@ -58,7 +58,7 @@ module I18n
     end
 
     def ensure_all_loaded!
-      backend.fallbacks(locale).each { |l| ensure_loaded!(l) }
+      I18n.fallbacks[locale].each { |l| ensure_loaded!(l) }
     end
 
     def search(query, opts = {})
@@ -153,7 +153,7 @@ module I18n
       if @overrides_enabled
         overrides = {}
 
-        backend.fallbacks(locale).each do |l|
+        I18n.fallbacks[locale].each do |l|
           overrides[l] = overrides_by_locale(l)
         end
 
diff --git a/lib/i18n/backend/discourse_i18n.rb b/lib/i18n/backend/discourse_i18n.rb
index 2b63b79..ad5313c 100644
--- a/lib/i18n/backend/discourse_i18n.rb
+++ b/lib/i18n/backend/discourse_i18n.rb
@@ -25,22 +25,6 @@ module I18n
         end
       end
 
-      def fallbacks(locale)
-        I18n.fallbacks[locale]
-      end
-
-      def exists?(locale, key)
-        fallbacks(locale).each do |fallback|
-          begin
-            return true if super(fallback, key)
-          rescue I18n::InvalidLocale
-            # we do nothing when the locale is invalid, as this is a fallback anyways.
-          end
-        end
-
-        false
-      end
-
       def self.create_search_regexp(query, as_string: false)
         regexp = Regexp.escape(query)
 
@@ -55,7 +39,7 @@ module I18n
         results = {}
         regexp = self.class.create_search_regexp(query)
 
-        fallbacks(locale).each do |fallback|
+        I18n.fallbacks[locale].each do |fallback|
           find_results(regexp, results, translations[fallback])
         end

GitHub sha: a3e4f43a

1 Like