X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/f8f7054fc2348378dacb244fa4f3192952fb34fe..ca4ee6faa9378e7610356e36cbd4931a2657eeed:/config/initializers/i18n.rb?ds=inline diff --git a/config/initializers/i18n.rb b/config/initializers/i18n.rb index 89ff677fb..8f74c3cd3 100644 --- a/config/initializers/i18n.rb +++ b/config/initializers/i18n.rb @@ -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 @@ -17,7 +18,7 @@ module OpenStreetMap def store_translations(locale, data, options = {}) locale = ::I18n::Locale::Tag::Rfc4646.tag(locale).to_s - super(locale, data, options) + super 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