Google Translate Fonksiyonu

Hepimiz biliyoruzdur herhalde arkadaşlar Google 'nin http://translate.google.com adresinde bize sunduğu çeviri hizmetini . İşte bu hizmeti basit bir fonksiyon ile bizde sitelelerimizde rahatlıkla kullannabiliriz.

İşte fonksiyon :

PHP:
  1. function Translate($str, $lang1="en", $lang2="tr"){
  2. $data = file_get_contents('http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q='.urlencode($str).'&langpair='.$lang1.'%7C'.$lang2.'');
  3.     $data = json_decode($data);
  4.     return $data->responseData->translatedText;
  5. }

Umarım işinize yarar ;)

33 views

2 Comments

  1. Elisabetta23lC diyor ki:

    Thank you very much for the nice text about this topic.

  2. yedincisenol diyor ki:

    Çok işimize yarayacak bir fonksiyon.
    Teşekkürler.

Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word