Search code examples
ruby-on-railsruby-on-rails-3internationalizationruby-on-rails-3.1ruby-on-rails-2

How to debug Rails I18N lookup?


In the Rails docs there seem to be different default locations for I18N strings, depending if the I18N-lookup was initiated from a view, model / validation, controller, helper, ..., if it's a label, etc...

How can I see where Rails is trying to lookup things by default, e.g. when I just use t('.something') ?


Solution

  • You can monkey patch the I18N backend in development mode to print out the I18n keys that are looked up in the backend.

    Check here:

    http://www.unixgods.org/Rails/where_is_Rails_trying_to_lookup_L10N_strings.html