lib/babel_i18n/translate.rb in babel_i18n-0.0.3 vs lib/babel_i18n/translate.rb in babel_i18n-0.0.4

- old
+ new

@@ -27,16 +27,14 @@ def source @from end def translate - google_translate if valid? + valid? ? google_translate : 'Error when translating' end def valid? - raise "parameter 'text' is necessary to translate" if @text.nil? || @text.empty? - raise "parameter 'to' is necessary to translate" if @to.nil? || @to.empty? - true + (!@text.nil? && !@text.empty?) && !@to.nil? end end end