added a commandline translate tool that uses my yandex free api key

This commit is contained in:
booboy 2018-11-04 00:13:54 -05:00
parent 65673b7ea3
commit ced4529a19

10
translate.rb Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env ruby
require 'yandex-translator'
translator = Yandex::Translator.new(ENV['yandex_key'])
text = ARGV[0]
lang_from = ARGV[1]
lang_to = ARGV[2]
puts translator.translate text, from: lang_from, to: lang_to