]> git.openstreetmap.org Git - rails.git/blob - vendor/plugins/globalize2/lib/rails_edge_load_path_patch.rb
Add russian pluralization logic, based on description in the russion
[rails.git] / vendor / plugins / globalize2 / lib / rails_edge_load_path_patch.rb
1 module I18n
2   @@load_path = nil
3   @@default_locale = :'en-US'
4   
5   class << self
6     def load_path
7       @@load_path ||= []
8     end
9     
10     def load_path=(load_path)
11       @@load_path = load_path
12     end
13   end
14 end
15
16 I18n::Backend::Simple.module_eval do
17   def initialized?
18     @initialized ||= false
19   end
20   
21   protected
22
23     def init_translations
24       load_translations(*I18n.load_path)
25       @initialized = true
26     end
27     
28     def lookup(locale, key, scope = [])
29       return unless key
30       init_translations unless initialized?
31       keys = I18n.send :normalize_translation_keys, locale, key, scope
32       keys.inject(translations){|result, k| result[k.to_sym] or return nil }
33     end
34 end
35
36 rails_dir = File.expand_path "#{File.dirname(__FILE__)}/../../../rails/"
37 paths = %w(actionpack/lib/action_view/locale/en-US.yml 
38            activerecord/lib/active_record/locale/en-US.yml
39            activesupport/lib/active_support/locale/en-US.yml)
40 paths.each{|path| I18n.load_path << "#{rails_dir}/#{path}" }