]> git.openstreetmap.org Git - rails.git/blob - config/initializers/i18n.rb
Change Where am I to Where is this on left sidebar
[rails.git] / config / initializers / i18n.rb
1 module I18n
2   module Backend
3     module PluralizationFallback
4       def pluralize(locale, entry, count)
5         super
6       rescue InvalidPluralizationData => ex
7         raise ex unless ex.entry.key?(:other)
8         ex.entry[:other]
9       end
10     end
11   end
12
13   module JS
14     class FallbackLocales
15       def default_fallbacks_with_validation
16         default_fallbacks_without_validation.select do |locale|
17           ::I18n.available_locales.include?(locale)
18         end
19       end
20
21       alias_method_chain :default_fallbacks, :validation
22     end
23   end
24 end
25
26 I18n::Backend::Simple.include(I18n::Backend::PluralizationFallback)
27 I18n::Backend::Simple.include(I18n::Backend::Fallbacks)
28
29 I18n.fallbacks.map("no" => "nb")
30
31 I18n.enforce_available_locales = false
32
33 Rails.configuration.after_initialize do
34   I18n.available_locales
35 end