#920 ✓resolved
Tomoaki Hayasaka

``<t>`` doesn't work

Reported by Tomoaki Hayasaka | February 19th, 2011 @ 09:48 PM

1.3.0pre27

<t> is broken by the commit 3c6267ab. <t> in a view calls rails' unmodified ActionView::Helpers::TranslationHelper::translate, which is not hobo's one. It doesn't take care of :key, so it always returns default fallback string.

Possible fix:

diff --git a/hobo/lib/hobo/engine.rb b/hobo/lib/hobo/engine.rb
index 9076a84..2f3f94d 100644
--- a/hobo/lib/hobo/engine.rb
+++ b/hobo/lib/hobo/engine.rb
@@ -37,7 +37,7 @@ module Hobo
 
     ActiveSupport.on_load(:action_view) do
       require 'hobo/extensions/action_view/tag_helper'
-      include Hobo::Extensions::ActionView::TranslationHelper
+      require 'hobo/extensions/action_view/translation_helper'
     end
 
     ActiveSupport.on_load(:before_initialize) do
diff --git a/hobo/lib/hobo/extensions/action_view/translation_helper.rb b/hobo/lib/hobo/extensions/action_view/translation_helper.rb
index 59ee534..cae403c 100644
--- a/hobo/lib/hobo/extensions/action_view/translation_helper.rb
+++ b/hobo/lib/hobo/extensions/action_view/translation_helper.rb
@@ -1,6 +1,6 @@
-module Hobo::Extensions::ActionView::TranslationHelper
+ActionView::Base.send :include, Hobo::Helper::Translations::Normalizer
 
-  include Hobo::Helper::Translations::Normalizer
+ActionView::Helpers::TranslationHelper.module_eval do
 
   # simple wrapper around the translate helper
   # it implements a dryml <translate> and a <t> tag

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

Tags

Pages