]> 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   original_verbosity = $VERBOSE
3   $VERBOSE = nil
4   INTERPOLATION_PATTERN = /\{\{(\w+)\}\}/
5   $VERBOSE = original_verbosity
6
7   module Backend
8     class Simple
9       module Implementation
10         protected
11         alias_method :old_init_translations, :init_translations
12       
13         def init_translations
14           old_init_translations
15
16           store_translations(:nb, translations[:no])
17           translations[:no] = translations[:nb]
18
19           friendly = translate('en', 'time.formats.friendly')
20
21           available_locales.each do |locale|
22             unless lookup(locale, 'time.formats.friendly')
23               store_translations(locale, :time => { :formats => { :friendly => friendly } })
24             end
25           end
26
27           @skip_syntax_deprecation = true
28         end
29       end
30     end
31
32     module PluralizationFallback
33       def pluralize(locale, entry, count)
34         super
35       rescue InvalidPluralizationData => ex
36         raise ex unless ex.entry.has_key?(:other)
37         ex.entry[:other]
38       end
39     end
40   end
41 end
42
43 I18n::Backend::Simple.send(:include, I18n::Backend::Pluralization)
44 I18n::Backend::Simple.send(:include, I18n::Backend::PluralizationFallback)
45 I18n.load_path << RAILS_ROOT + "/config/pluralizers.rb"
46
47 I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)