bin/translate in shvets-google_translate-0.5.9 vs bin/translate in shvets-google_translate-0.6.1
- old
+ new
@@ -6,10 +6,11 @@
require 'google_translate'
#$KCODE='u'
class Translate
+
USAGE= <<-TEXT
Usage:
translate list - displays the list of supported languages
translate detect "hello world" - detects language of text
translate en:ru "hello world" - translates from en to ru
@@ -60,10 +61,14 @@
from_text = ARGV.join(' ')
from = @translator.detect_language(from_text)['language']
to = $1
- display(@translator.translate(from.to_sym, to.to_sym, from_text))
+ begin
+ display(@translator.translate(from.to_sym, to.to_sym, from_text))
+ rescue Exception => e
+ puts "Error: " + e.message
+ end
end
end
end
Translate.new.run