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