79531336

Date: 2025-03-24 14:37:56
Score: 0.5
Natty:
Report link

Answer https://stackoverflow.com/a/8379421/1878731 adapted to Rails 8:

require 'i18n'

if (Rails.env.development? || Rails.env.test?) && ENV['DEBUG_TRANSLATION']
  module I18nDebug
    def translate(key = nil, throw: false, raise: false, locale: nil, **options)
      Rails.logger.debug "Translate: #{[key, { throw:, raise:, locale:, **options }].inspect}"
      super
    end
  end

  I18n.singleton_class.prepend(I18nDebug)
end
Reasons:
  • Blacklisted phrase (1): stackoverflow
  • Probably link only (1):
  • Has code block (-0.5):
  • High reputation (-1):
Posted by: mirelon