]> git.openstreetmap.org Git - rails.git/blobdiff - config/initializers/i18n.rb
Merge remote-tracking branch 'upstream/pull/2892'
[rails.git] / config / initializers / i18n.rb
index 89ff677fb2c4aeacd53ebf06ae9cca24ffa02bd4..266e41cbb98d501435ba985efbdba9af475c8d63 100644 (file)
@@ -3,9 +3,10 @@ module I18n
     module PluralizationFallback
       def pluralize(locale, entry, count)
         super
-      rescue InvalidPluralizationData => ex
-        raise ex unless ex.entry.key?(:other)
-        ex.entry[:other]
+      rescue InvalidPluralizationData => e
+        raise e unless e.entry.key?(:other)
+
+        e.entry[:other]
       end
     end
   end
@@ -41,6 +42,12 @@ I18n.fallbacks.map("no" => "nb")
 
 I18n.enforce_available_locales = false
 
+if Rails.env.test?
+  I18n.exception_handler = proc do |exception|
+    raise exception.to_exception
+  end
+end
+
 Rails.configuration.after_initialize do
   I18n.available_locales
 end