eXorithm – Execute Algorithm: View / Run Algorithm google_translate

Logo Beta

function google_translate ($text$from$to

{

  $transfile_get_contents"http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q="urlencode$text)."&langpair="urlencode$from)."|"urlencode$to));

  $json = json_decode$trans);

  

  if (!isset$json->responseStatus) || ($json->responseStatus!=200)) {

    throw new Exception"Translation could not be retreived for '$text'");

  }

  

  return $json->responseData->translatedText;