added a commandline translate tool that uses my yandex free api key
This commit is contained in:
parent
65673b7ea3
commit
ced4529a19
1 changed files with 10 additions and 0 deletions
10
translate.rb
Executable file
10
translate.rb
Executable 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
|
Loading…
Add table
Reference in a new issue