Created
March 15, 2013 23:55
-
-
Save tomeduarte/5174151 to your computer and use it in GitHub Desktop.
A Ruby on Rails initializer which binds I18n.translate and logs every lookup to logs/i18n_registry.log. Tested on Rails 3.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# adapted from: http://stackoverflow.com/a/10211540/514700 | |
module I18n | |
module Registry | |
protected | |
def lookup(locale, key, scope = [], options = {}) | |
@log ||= Logger.new(File.join(Rails.root, 'log', 'i18n_registry.log')) | |
@log.info "i18n lookup - key: #{key} | locale: #{locale} | scope: #{scope}" | |
super | |
end | |
end | |
end | |
I18n::Backend::Simple.send :include, I18n::Registry |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment