Jump to content

Recommended Posts

May I ask why you first link to the API, but don't use it anyway?

 

You can just call the API directly instead of parsing the output of the translating frontend...

 

function translate($textSource, $langSource, $langTarget)
{
$ch = curl_init();
curl_setopt_array($ch, array(
	CURLOPT_URL => 'http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=' . urlencode($textSource) . '&langpair=' . urlencode($langSource . '|' . $langTarget),
	CURLOPT_RETURNTRANSFER => true
));

$ret = json_decode(curl_exec($ch), true);
curl_close($ch);

if ($ret['responseStatus'] != '200') {
	throw Exception('Translation failed.');
}

return $ret['responseData']['translatedText'];
}

echo translate('ciao', 'it', 'en');

google seems like his best bet

 

the output will not be perfect in arabic but I am sure he could edit it so it makes sense.

 

http://translate.google.com/

 

I translated a site from english to chinese using google and it was a far from perfect translation lol

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.