Created
February 21, 2011 14:29
-
-
Save gregoriokusowski/837121 to your computer and use it in GitHub Desktop.
A helper that finds the informed word(when running in shell), and gives all the options, with the respectives I18n keys, like "activerecord.models.attributes.etc.name"
This file contains 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
require 'yaml' | |
@sentence = ARGV.shift | |
def find(path, map) | |
map.each do |key, value| | |
if value.is_a? Hash | |
find("#{path}#{key}.", value) | |
else | |
puts "#{path}#{key} - #{value}" if value =~ /#{@sentence}/ | |
end | |
end | |
end | |
@translations = YAML.load(File.open('config/locales/pt.yml')) | |
find("", @translations) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment