How to translate with google translate
I have received many requests from my readers on translation of web application so today i have decided to write a tutorial on translate. I have used google translate to translate any word in almost 64 languages simply download package and start translating.
[wpdm_file id=22]DEMO
Here is some code snippets:
<?php require_once("class.translate.php"); $var = new translate($_POST['from'],$_POST['to']); $content = "Translation of: '".$_POST['word']."' <b>".$var->get($_POST['word'])."</b>"; ?>
Translation Class function which perform translation:
if(!$word){ die("you need to adda a translate word"); } ///we need to encode the word that we want to translate $word = urlencode($word); $url = "http://translate.google.com/?sl=". $this->translate_from ."&tl=". $this->translate_into ."&js=n&prev=_t&hl=it&ie=UTF-8&eotf=1&text=". $word .""; return $url;
Use this simple code and make your applications super cool 🙂
Tutorial Categories:
Dear sir
Thank you for your tutorial.
I used your translator but it did not work. it returns only the same word not the meaning. your demo is the same too. please help me to solve the problem.
Best regards
it did not work
brother it does’nt work i think google translation api is no more free
Not work – Translation of: ‘Hello World’ from English to Thai = Hello World.
Not work – Translation of: ‘Hello World’ from English to Thai = Hello World.