]> git.openstreetmap.org Git - rails.git/blob - config/initializers/i18n.rb
Detabify
[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
22           @skip_syntax_deprecation = true
23         end
24       end
25     end
26
27     module PluralizationFallback
28       def pluralize(locale, entry, count)
29         super
30       rescue InvalidPluralizationData => ex
31         raise ex unless ex.entry.has_key?(:other)
32         ex.entry[:other]
33       end
34     end
35   end
36 end
37
38 I18n::Backend::Simple.send(:include, I18n::Backend::Pluralization)
39 I18n::Backend::Simple.send(:include, I18n::Backend::PluralizationFallback)
40 I18n.load_path << "#{Rails.root}/config/pluralizers.rb"
41
42 I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
43
44 Rails.configuration.after_initialize do
45   I18n.reload!
46 end