ActiveSupport not including i18n?

Went to use ActiveSupport in a gem today and got an error on account of not having i18n installed. Either bundler should be installing i18n along with activesupport or docs need to be updated.

quick repro: https://github.com/softwaregravy/repro_active_support_i18n

bundle exec irb

require ‘active_support/all’

detailed steps and error:

  1. add to Gemfile

require ‘activesupport’

  1. try it out

bundle exec irb

require ‘active_support/core_ext’

You don’t have i18n installed in your application. Please add it to your Gemfile and run bundle install

LoadError: no such file to load – i18n

from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/i18n.rb:2:in `require’

from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/i18n.rb:2:in `<top (required)>’

from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/inflector/transliterate.rb:3:in `require’

from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/inflector/transliterate.rb:3:in `<top (required)>’

from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/core_ext/string/inflections.rb:3:in `require’

from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/core_ext/string/inflections.rb:3:in `<top (required)>’

from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/core_ext/array/conversions.rb:4:in `require’

from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/core_ext/array/conversions.rb:4:in `<top (required)>’

from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/core_ext/array.rb:4:in `require’

from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/core_ext/array.rb:4:in `<top (required)>’

from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/core_ext.rb:2:in `require’

from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/core_ext.rb:2:in `block in <top (required)>’

from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/core_ext.rb:1:in `each’

from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/core_ext.rb:1:in `<top (required)>’

from (irb):1:in `require’

from (irb):1

from /Users/MacbookPro/.rvm/rubies/ruby-1.9.2-p0/bin/irb:16:in `'ruby-1.9.2-p0 :002 > exit

Sure enough i18n is not installed by bundler when requiring activesupport.

Fix: adding require i18n to my Gemfile and running the bundle install did fix the problem.

When running bundle install, I see

Using activesupport (3.0.9)

Looked at the source, I see the dependency listed in the gemspec.

I’m unblocked, but I’m of the opinion that I should not have needed to add i18n as a dependency of my project. If that’s not the case, then we should update the docs that say 'to use activesupport, just add “require ‘activesupport’” to your Gemfile to mention the requirement for i18n

Went to use ActiveSupport in a gem today and got an error on account of not having i18n installed. Either bundler should be installing i18n along with activesupport or docs need to be updated.

quick repro: https://github.com/softwaregravy/repro_active_support_i18n

bundle exec irb

require ‘active_support/all’

detailed steps and error:

  1. add to Gemfile

require ‘activesupport’

  1. try it out

bundle exec irb

require ‘active_support/core_ext’

You don’t have i18n installed in your application. Please add it to your Gemfile and run bundle install

LoadError: no such file to load – i18n

from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/i18n.rb:2:in `require’

from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/i18n.rb:2:in `<top (required)>’

from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/inflector/transliterate.rb:3:in `require’

from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/inflector/transliterate.rb:3:in `<top (required)>’

from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/core_ext/string/inflections.rb:3:in `require’

from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/core_ext/string/inflections.rb:3:in `<top (required)>’

from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/core_ext/array/conversions.rb:4:in `require’

from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/core_ext/array/conversions.rb:4:in `<top (required)>’

from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/core_ext/array.rb:4:in `require’

from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/core_ext/array.rb:4:in `<top (required)>’

from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/core_ext.rb:2:in `require’

from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/core_ext.rb:2:in `block in <top (required)>’

from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/core_ext.rb:1:in `each’

from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/core_ext.rb:1:in `<top (required)>’

from (irb):1:in `require’

from (irb):1

from /Users/MacbookPro/.rvm/rubies/ruby-1.9.2-p0/bin/irb:16:in `'ruby-1.9.2-p0 :002 > exit

Sure enough i18n is not installed by bundler when requiring activesupport.

Fix: adding require i18n to my Gemfile and running the bundle install did fix the problem.

When running bundle install, I see

Using activesupport (3.0.9)

Looked at the source, I see the dependency listed in the gemspec.

You do? Where?

https://github.com/rails/rails/blob/3-0-9/activesupport/activesupport.gemspec (3.0.9 branch)
https://github.com/rails/rails/blob/3-0-stable/activesupport/activesupport.gemspec (3.0-stable branch)

I’m unblocked, but I’m of the opinion that I should not have needed to add i18n as a dependency of my project. If that’s not the case, then we should update the docs that say 'to use activesupport, just add “require ‘activesupport’” to your Gemfile to mention the requirement for i18n

I agree with you here. If simply using the core extensions need i18n, then it must be dependency. Perhaps you should post this to the “Ruby on Rails: Core” mailing list: https://groups.google.com/forum/#!forum/rubyonrails-core

Forwarding to core.

Long story short: I think activesupport should depend explicitly on i18n

PS. If agreed, I’d love to do the change. I’ve not contributed to rails before, and I’d love to get my feet we with something simple.