3     module PluralizationFallback
 
   4       def pluralize(locale, entry, count)
 
   6       rescue InvalidPluralizationData => e
 
   7         raise e unless e.entry.key?(:other)
 
  17     module NormaliseLocales
 
  18       def store_translations(locale, data, options = {})
 
  19         locale = ::I18n::Locale::Tag::Rfc4646.tag(locale).to_s
 
  21         super(locale, data, options)
 
  25     module ValidateLocales
 
  27         super.select do |locale|
 
  28           ::I18n.available_locales.include?(locale)
 
  35 I18n::Backend::Simple.prepend(OpenStreetMap::I18n::NormaliseLocales)
 
  36 I18n::JS::FallbackLocales.prepend(OpenStreetMap::I18n::ValidateLocales)
 
  38 I18n::Backend::Simple.include(I18n::Backend::PluralizationFallback)
 
  39 I18n::Backend::Simple.include(I18n::Backend::Fallbacks)
 
  41 I18n.fallbacks.map("no" => "nb")
 
  43 I18n.enforce_available_locales = false
 
  46   I18n.exception_handler = proc do |exception|
 
  47     raise exception.to_exception
 
  51 Rails.configuration.after_initialize do
 
  52   I18n.available_locales