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)
15 module NormaliseLocales
16 def store_translations(locale, data, options = {})
17 locale = ::I18n::Locale::Tag::Rfc4646.tag(locale).to_s
25 I18n::Backend::Simple.prepend(OpenStreetMap::I18n::NormaliseLocales)
27 I18n::Backend::Simple.include(OpenStreetMap::I18n::PluralizationFallback)
28 I18n::Backend::Simple.include(I18n::Backend::Fallbacks)
30 I18n.enforce_available_locales = false
33 I18n.exception_handler = proc do |exception|
34 raise exception.to_exception
38 Rails.configuration.after_initialize do
39 require "i18n-js/listen"
41 # This will only run in development.
44 I18n.available_locales
47 AVAILABLE_LANGUAGES = YAML.load_file(Rails.root.join("config/ui_languages.yml"))