Skip to content

Instantly share code, notes, and snippets.

@itarato
Last active November 28, 2018 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itarato/be77d1751e56668c8a93c82162296cfc to your computer and use it in GitHub Desktop.
Save itarato/be77d1751e56668c8a93c82162296cfc to your computer and use it in GitHub Desktop.
Translation finder
# USAGE: ruby PATH_TO_SCRIPT/translation.rb "TOKEN_TO_TRANSLATE"
require 'yaml'
LANG = 'en'
subject = ARGV[0].split('.')
`find . -name '#{LANG}.yml'`
.lines
.map { |line| YAML.load(IO.read(line.strip))[LANG] }
.each do |translation|
res = translation.dig(*subject)
puts res if res
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment