Nick Gorbikov’s answer was the beginning, but did not produce the result that I wanted, as described in the question. In the end, I wrote my own get_translations script to do this below.
#!/usr/bin/env ruby require 'pp' require './config/environment.rb' def print_translations(prefix, x) if x.is_a? Hash if (not prefix.empty?) prefix += "." end x.each {|key, value| print_translations(prefix + key.to_s, value) } else print prefix + ": " PP.singleline_pp x puts "" end end I18n.translate(:foo) translations_hash = I18n.backend.send(:translations) print_translations("", translations_hash)
source share