#706 ✓resolved
averell23

I18n view hints broken?

Reported by averell23 | April 19th, 2010 @ 04:48 PM | in Hobo 1.3 (Rails 3)

We've got the problem that the view hints translations don't work when we set the correct local in a before_filter.

After some investigation it appears that the translations for model names are set during the reload phase, when classes are reloaded and (in the hobo case) the dryml is rebuilt.

This means it's outside the normal controller/request lifecycle and I don't see any way to pre-empt it without hacking even more into the code. Also, I assume that the reloading will often be skipped in production mode - will this mean that the translations are stuck in that case?

We'd have expected that the view_translations are loaded when the dryml is rendered, after the :before_filters and inside the normal rendering cycle.

Here's the stack trace from Rails' i18n.rb#translate method:

/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/hobo-1.0.0/lib/hobo/translations.rb:67:in `ht'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/hobo-1.0.0/lib/hobo/view_hints.rb:84:in `model_name_plural'
rapid/pages:7:in `instance_eval'
rapid/pages:6:in `each'
rapid/pages:6:in `instance_eval'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/hobo-1.0.0/lib/hobo/dryml/dryml_generator.rb:99:in `run_one'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/hobo-1.0.0/lib/hobo/dryml/dryml_generator.rb:88:in `run_for_subsite'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/hobo-1.0.0/lib/hobo/dryml/dryml_generator.rb:87:in `each_pair'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/hobo-1.0.0/lib/hobo/dryml/dryml_generator.rb:87:in `run_for_subsite'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/hobo-1.0.0/lib/hobo/dryml/dryml_generator.rb:81:in `run'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/hobo-1.0.0/lib/hobo/dryml/dryml_generator.rb:81:in `each'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/hobo-1.0.0/lib/hobo/dryml/dryml_generator.rb:81:in `run'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/hobo-1.0.0/lib/hobo/dryml/dryml_generator.rb:50:in `run'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/hobo-1.0.0/lib/hobo/dryml/dryml_generator.rb:33:in  `reload_application_with_dryml_generators'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/reloader.rb:33:in `run'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:108:in `call'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/rack/static.rb:31:in `call'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/urlmap.rb:48:in `call'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/urlmap.rb:40:in `each'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/urlmap.rb:40:in `call'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/rack/log_tailer.rb:17:in `call'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/content_length.rb:13:in `call'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/chunked.rb:15:in `call'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/handler/mongrel.rb:64:in `process'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:159:in `process_client'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:158:in `each'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:158:in `process_client'
/Developer/Talia/talia_new_2.3/vendor/plugins/spawn/lib/patches.rb:61:in `process_client'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:285:in `run'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:285:in `initialize'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:285:in `new'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:285:in `run'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:268:in `initialize'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:268:in `new'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:268:in `run'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/handler/mongrel.rb:34:in `run'
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:111
/Developer/Talia/jruby-1.4.0/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:31:in `require'
/usr/local/jruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
script/server:3

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

People watching this ticket

Pages