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