amatsuda / i18n_generators

A pack of Rails generators gem plugin that generates Rails 3 and Rails 2 I18n locale files for almost every known locale.
http://github.com/amatsuda/i18n_generators
MIT License
296 stars 29 forks source link

undefined method `eager_load_with_dependencies!' #25

Closed imgarylai closed 5 years ago

imgarylai commented 5 years ago

Thank you for this awesome work! I am developing my service on Rails and want to use this gem to generate all locale files. However, it doesn't work as expected.

The development environment I'm using is on Rails rc1 and ruby 2.6.3. I add this gem to the development group in Gemfile.

When I run the generation command, I get this message.

bundle exec rails g i18n en
Running via Spring preloader in process 81707
fetching en.yml from rails-i18n repository...
   identical  config/locales/en.yml
translating models to en...
Traceback (most recent call last):
26: from -e:1:in `<main>'
25: from ~/.rbenv/versions/2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
24: from ~/.rbenv/versions/2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
23: from ~/Documents/example/bin/rails:11:in `<top (required)>'
22: from ~/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.rc1/lib/active_support/dependencies.rb:302:in `require'
21: from ~/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.rc1/lib/active_support/dependencies.rb:268:in `load_dependency'
20: from ~/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.rc1/lib/active_support/dependencies.rb:302:in `block in require'
19: from ~/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/zeitwerk-2.1.6/lib/zeitwerk/kernel.rb:23:in `require'
18: from ~/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/zeitwerk-2.1.6/lib/zeitwerk/kernel.rb:23:in `require'
17: from ~/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/commands.rb:18:in `<top (required)>'
16: from ~/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/command.rb:46:in `invoke'
15: from ~/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/command/base.rb:65:in `perform'
14: from ~/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
13: from ~/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
12: from ~/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
11: from ~/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/commands/generate/generate_command.rb:26:in `perform'
10: from ~/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/generators.rb:276:in `invoke'
9: from ~/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
8: from ~/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/group.rb:232:in `dispatch'
7: from ~/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:133:in `invoke_all'
6: from ~/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:133:in `map'
5: from ~/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:133:in `each'
4: from ~/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:133:in `block in invoke_all'
3: from ~/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
2: from ~/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
1: from ~/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/i18n_generators-2.2.1/lib/generators/i18n/i18n_generator.rb:15:in `main'
~/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/i18n_generators-2.2.1/lib/generators/i18n_translation/i18n_translation_generator.rb:15:in `main': undefined method `eager_load_with_dependencies!' for #<MariGen::Application:0x00007fe9f6913ce0> (NoMethodError)
imgarylai commented 5 years ago

I opt out zeitwerk and get the generation work by adding config.autoloader = :classic after config.load_defaults 6.0 in config/application.rb.

Ref: https://github.com/rails/rails/pull/35235

amatsuda commented 5 years ago

@imgarylai Thank you for reporting this! I just released version 2.2.2 gem with a fix for this bug. Could you try again with 2.2.2 please? Thanks!

imgarylai commented 5 years ago

@amatsuda Thank you for your instant response! The issue was fixed.

amatsuda commented 5 years ago

@imgarylai Thank you for confirming! 👍