How to Intercept all calls to I18n.t() method to see its parameters.

Sometimes it is not easy to understand the documentation of Rails or some library when its explaining the way it calls I18n. Here is my way to easily figure it out. You can put it in your environement.rb . Running it only in development mode is recommended.

I18n.class_eval do
class << self

def translate_with_output(*args)
puts "Translation called with arguments: "
args.each{|a| puts a.inspect}

alias_method_chain :translate, :output
alias_method :t, :translate

Popularne posty z tego bloga

Faster rails development part 2 - Annoucing Active Reload