3 module PluralizationFallback
4 def pluralize(locale, entry, count)
6 rescue InvalidPluralizationData => ex
7 raise ex unless ex.entry.key?(:other)
16 module NormaliseLocales
17 def store_translations(locale, data, options = {})
18 locale = ::I18n::Locale::Tag::Rfc4646.tag(locale).to_s
20 super(locale, data, options)
24 module ValidateLocales
26 super.select do |locale|
27 ::I18n.available_locales.include?(locale)
34 I18n::Backend::Simple.prepend(OpenStreetMap::I18n::NormaliseLocales)
35 I18n::JS::FallbackLocales.prepend(OpenStreetMap::I18n::ValidateLocales)
37 I18n::Backend::Simple.include(I18n::Backend::PluralizationFallback)
38 I18n::Backend::Simple.include(I18n::Backend::Fallbacks)
40 I18n.fallbacks.map("no" => "nb")
42 I18n.enforce_available_locales = false
44 Rails.configuration.after_initialize do
45 I18n.available_locales