]> git.openstreetmap.org Git - rails.git/blob - config/initializers/i18n.rb
Require i18n version 0.4.1 and fix monkey patch to work with it
[rails.git] / config / initializers / i18n.rb
1 module I18n
2   module Backend
3     class Simple
4       module Implementation
5         protected
6         alias_method :old_init_translations, :init_translations
7       
8         def init_translations
9           old_init_translations
10
11           store_translations(:nb, translations[:no])
12           translations[:no] = translations[:nb]
13
14           friendly = translate('en', 'time.formats.friendly')
15
16           available_locales.each do |locale|
17             unless lookup(locale, 'time.formats.friendly')
18               store_translations(locale, :time => { :formats => { :friendly => friendly } })
19             end
20           end
21         end
22       end
23     end
24
25     module PluralizationFallback
26       def pluralize(locale, entry, count)
27         super
28       rescue InvalidPluralizationData => ex
29         raise ex unless ex.entry.has_key?(:other)
30         ex.entry[:other]
31       end
32     end
33   end
34 end
35
36 I18n::Backend::Simple.send(:include, I18n::Backend::Pluralization)
37 I18n::Backend::Simple.send(:include, I18n::Backend::PluralizationFallback)
38 I18n.load_path << RAILS_ROOT + "/config/pluralizers.rb"
39
40 I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)