Skip to content
This repository
Browse code

Fix the i18n dependency problem

  • Loading branch information...
commit 1cd949006a419807d5ae3400442942b752780ca2 1 parent 9521fcb
David Heinemeier Hansson authored
3  activesupport/lib/active_support.rb
@@ -70,6 +70,3 @@ module ActiveSupport
70 70
 end
71 71
 
72 72
 require 'active_support/vendor'
73  
-
74  
-require 'i18n'
75  
-I18n.load_path << "#{File.dirname(__FILE__)}/active_support/locale/en.yml"
1  activesupport/lib/active_support/all.rb
... ...
@@ -1,3 +1,4 @@
1 1
 require 'active_support'
  2
+require 'active_support/i18n'
2 3
 require 'active_support/time'
3 4
 require 'active_support/core_ext'
1  activesupport/lib/active_support/core_ext/array/conversions.rb
... ...
@@ -1,6 +1,7 @@
1 1
 require 'active_support/core_ext/hash/keys'
2 2
 require 'active_support/core_ext/hash/reverse_merge'
3 3
 require 'active_support/inflector'
  4
+require 'active_support/i18n'
4 5
 
5 6
 class Array
6 7
   # Converts the array to a comma-separated sentence where the last element is joined by the connector word. Options:
2  activesupport/lib/active_support/i18n.rb
... ...
@@ -0,0 +1,2 @@
  1
+require 'i18n'
  2
+I18n.load_path << "#{File.dirname(__FILE__)}/locale/en.yml"
2  railties/bin/rails
@@ -20,7 +20,7 @@ end
20 20
 
21 21
 ARGV << "--help" if ARGV.empty?
22 22
 
23  
-require 'rails'
  23
+
24 24
 require 'rails/generators'
25 25
 require 'rails/generators/rails/app/app_generator'
26 26
 
7  railties/lib/rails/generators.rb
@@ -4,8 +4,7 @@
4 4
 require 'active_support'
5 5
 require 'active_support/core_ext/object/blank'
6 6
 require 'active_support/core_ext/object/metaclass'
7  
-require 'active_support/core_ext/array'
8  
-require 'active_support/core_ext/hash'
  7
+require 'active_support/core_ext/array/extract_options'
9 8
 require 'active_support/core_ext/module/attribute_accessors'
10 9
 require 'active_support/core_ext/string/inflections'
11 10
 
@@ -95,7 +94,7 @@ def self.gems_generators_paths #:nodoc:
95 94
     end
96 95
 
97 96
     def self.plugins_generators_paths #:nodoc:
98  
-      return [] unless Rails.root
  97
+      return [] unless defined?(Rails.root)
99 98
       Dir[File.join(Rails.root, "vendor", "plugins", "*", "lib", "{generators,rails_generators}")]
100 99
     end
101 100
 
@@ -136,7 +135,7 @@ def self.no_color!
136 135
     def self.load_paths
137 136
       @load_paths ||= begin
138 137
         paths = []
139  
-        paths += Dir[File.join(Rails.root, "lib", "{generators,rails_generators}")] if Rails.root
  138
+        paths += Dir[File.join(Rails.root, "lib", "{generators,rails_generators}")] if defined?(Rails.root)
140 139
         paths += Dir[File.join(Thor::Util.user_home, ".rails", "{generators,rails_generators}")]
141 140
         paths += self.plugins_generators_paths
142 141
         paths += self.gems_generators_paths

3 notes on commit 1cd9490

Joshua Partogi

Why do we require 'i18n' inside active_support/i18n.rb?
That cause this error:
active_support/i18n.rb:1:inrequire': no such file to load -- i18n (LoadError)`

José Valim
Owner

When you require active_support/i18n, is because you want to require i18n and configure its active support hooks.
At that point, you should already have I18n in your loadpath.

Joshua Partogi

I see. The i18n library has been removed from activesupport/vendor/ now.

Please sign in to comment.
Something went wrong with that request. Please try again.