I'm trying to add some custom behavior to I18n. Since we want this behavior to be performed in I18n itself as well as the Rails TranslationHelper
before their respective translate
methods, I've created the following module in lib/translate_extension.rb
:
module TranslateExtention
def new_translate(*args)
...
translate(...)
end
end
In config/initializers/i18n.rb
the following is working:
module I18n
extend TranslateExtention
end
However I'm having trouble getting it added as a helper. The following in config/initializers/translation_helper.rb
is not doing the trick:
module ActionView
module Helpers
module TranslationHelper
include TranslateExtention
end
end
end
I keep getting told that new_translate
is not defined for my views.
This is being done on Rails 3.2.22
Aucun commentaire:
Enregistrer un commentaire