Skip to content

Commit

Permalink
Merge pull request #2 from gogromat/patch-1
Browse files Browse the repository at this point in the history
fix translation for multiple sentences
  • Loading branch information
Stichoza committed Sep 2, 2013
2 parents 09e3c6b + 79c016c commit c032abf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion GoogleTranslate.php
Expand Up @@ -112,7 +112,9 @@ public function translate($string) {
$url = sprintf(self::$urlFormat, rawurlencode($string), $this->langFrom, $this->langTo);
$result = preg_replace('!,+!', ',', self::makeCurl($url)); // remove repeated commas (causing JSON syntax error)
$resultArray = json_decode($result, true);
return $this->lastResult = $resultArray[0][0][0];
$finalResult = "";
foreach ($resultArray[0] as $results) $finalResult .= $results[0];
return $this->lastResult = $finalResult;
}

/**
Expand Down

0 comments on commit c032abf

Please sign in to comment.