]> git.openstreetmap.org Git - rails.git/blob - config/initializers/i18n.rb
Add a temporary hack to suppress some broken rails translations
[rails.git] / config / initializers / i18n.rb
1 module I18n
2   module Backend
3     class Simple
4       def init_translations_with_mn_cleanup
5         init_translations_without_mn_cleanup
6
7         translations[:mn][:errors][:template].delete(:body)
8         translations[:mn][:activemodel][:errors][:template].delete(:body)
9         translations[:mn][:activerecord][:errors][:template].delete(:body)
10       end
11
12       alias_method_chain :init_translations, :mn_cleanup
13     end
14
15     module Fallbacks
16       def find_first_string_or_lambda_default(defaults)
17         defaults.each_with_index { |default, ix| return ix if default && !default.is_a?(Symbol) }
18         nil
19       end
20     end
21
22     module PluralizationFallback
23       def pluralize(locale, entry, count)
24         super
25       rescue InvalidPluralizationData => ex
26         raise ex unless ex.entry.has_key?(:other)
27         ex.entry[:other]
28       end
29     end
30   end
31 end
32
33 I18n::Backend::Simple.include(I18n::Backend::PluralizationFallback)
34 I18n::Backend::Simple.include(I18n::Backend::Fallbacks)
35
36 I18n.fallbacks.map("no" => "nb")