]> git.openstreetmap.org Git - rails.git/blob - config/initializers/i18n.rb
Added support for reporting Changesets + Deleting issues from the CLI
[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
12     class Simple
13       def store_translations_with_normalisation(locale, data, options = {})
14         locale = I18n::Locale::Tag::Rfc4646.tag(locale).to_s
15
16         store_translations_without_normalisation(locale, data, options)
17       end
18
19       alias_method_chain :store_translations, :normalisation
20     end
21   end
22
23   module JS
24     class FallbackLocales
25       def default_fallbacks_with_validation
26         default_fallbacks_without_validation.select do |locale|
27           ::I18n.available_locales.include?(locale)
28         end
29       end
30
31       alias_method_chain :default_fallbacks, :validation
32     end
33   end
34 end
35
36 I18n::Backend::Simple.include(I18n::Backend::PluralizationFallback)
37 I18n::Backend::Simple.include(I18n::Backend::Fallbacks)
38
39 I18n.fallbacks.map("no" => "nb")
40
41 I18n.enforce_available_locales = false
42
43 Rails.configuration.after_initialize do
44   I18n.available_locales
45 end