From: Chris Date: Wed, 2 Apr 2014 13:00:54 +0000 (+0800) Subject: GoogleTranslate.php X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=commitdiff_plain;h=9442b4f499c56638c5513d0b144c1f791fd50a32 GoogleTranslate.php --- diff --git a/GoogleTranslate.php b/GoogleTranslate.php index f9ec20f4..a2063083 100644 --- a/GoogleTranslate.php +++ b/GoogleTranslate.php @@ -52,12 +52,13 @@ class Pman_Core_GoogleTranslate extends Pman $responseDecoded = json_decode($response); curl_close($handle); + if(!empty($responseDecoded->error)){ $this->jerr($responseDecoded->error->message); } - $responseDecoded->data->data->translations[0]->translatedText = rawurldecode($responseDecoded->data->data->translations[0]->translatedText); - $this->jok($responseDecoded->data->data->translations[0]); + $responseDecoded->data->translations[0]->translatedText = rawurldecode($responseDecoded->data->data->translations[0]->translatedText); + $this->jok($responseDecoded->data->translations[0]); }