1 # frozen_string_literal: true
 
   5     module PluralizationFallback
 
   6       def pluralize(locale, entry, count)
 
   8       rescue InvalidPluralizationData => e
 
   9         raise e unless e.entry.key?(:other)
 
  19     module NormaliseLocales
 
  20       def store_translations(locale, data, options = {})
 
  21         locale = ::I18n::Locale::Tag::Rfc4646.tag(locale).to_s
 
  29 I18n::Backend::Simple.prepend(OpenStreetMap::I18n::NormaliseLocales)
 
  31 I18n::Backend::Simple.include(I18n::Backend::PluralizationFallback)
 
  32 I18n::Backend::Simple.include(I18n::Backend::Fallbacks)
 
  34 I18n.enforce_available_locales = false
 
  37   I18n.exception_handler = proc do |exception|
 
  38     raise exception.to_exception
 
  42 Rails.configuration.after_initialize do
 
  43   require "i18n-js/listen"
 
  45   # This will only run in development.
 
  48   I18n.available_locales
 
  51 AVAILABLE_LANGUAGES = YAML.load_file(Rails.root.join("config/ui_languages.yml"))