{"id":281,"date":"2024-01-08T05:02:36","date_gmt":"2024-01-08T05:02:36","guid":{"rendered":"http:\/\/www.phpgang.com\/?p=281---6f18965e-c102-4c1a-9d04-a1ed35e7b578"},"modified":"2024-01-08T05:02:36","modified_gmt":"2024-01-08T05:02:36","slug":"how-to-translate-with-google-translate-php","status":"publish","type":"post","link":"https:\/\/www.phpgang.com\/how-to-translate-with-google-translate-php_281.html","title":{"rendered":"How to translate with google translate"},"content":{"rendered":"

I have received many requests<\/a> from my readers on translation of web application so today i have decided to write a tutorial on translate. I have used google<\/a> translate to translate any word in almost 64 languages simply download package and start translating.<\/p>\n

\"Google-Translate\"<\/p>\n

[wpdm_file id=22]DEMO<\/a><\/div>\n

Here is some code snippets:<\/p>\n

<?php \r\n    require_once(\"class.translate.php\"); \r\n\r\n    $var = new translate($_POST['from'],$_POST['to']); \r\n    $content    = \"Translation of: '\".$_POST['word'].\"' <b>\".$var->get($_POST['word']).\"<\/b>\";\r\n?><\/pre>\n

Translation Class function which perform translation:<\/p>\n

if(!$word){ \r\n\r\n            die(\"you need to adda a translate word\"); \r\n        } \r\n        \/\/\/we need to encode the word that we want to translate \r\n\r\n        $word = urlencode($word); \r\n\r\n        $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 .\"\"; \r\n\r\n        return $url;<\/pre>\n

Use this simple code and make your applications super cool \ud83d\ude42<\/p>\n

Facebook<\/a><\/blockquote><\/div><\/div>
Tutorial Categories:<\/strong>
\n \"PHP\"<\/a><\/div><\/div>","protected":false},"excerpt":{"rendered":"

I have received many requests<\/a> from my readers on translation of web application so today i have decided to write a tutorial on translate. I have used google<\/a> translate to translate any word in almost 64 languages simply download package and start translating.<\/p>\n

\"Google-Translate\"<\/p>\n","protected":false},"author":1,"featured_media":282,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"twitterCardType":"","cardImageID":0,"cardImage":"","cardTitle":"","cardDesc":"","cardImageAlt":"","cardPlayer":"","cardPlayerWidth":0,"cardPlayerHeight":0,"cardPlayerStream":"","cardPlayerCodec":"","footnotes":""},"categories":[164,3],"tags":[93,137,623,22,23,25,21,20,136,138,24],"_links":{"self":[{"href":"https:\/\/www.phpgang.com\/wp-json\/wp\/v2\/posts\/281"}],"collection":[{"href":"https:\/\/www.phpgang.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.phpgang.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.phpgang.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.phpgang.com\/wp-json\/wp\/v2\/comments?post=281"}],"version-history":[{"count":0,"href":"https:\/\/www.phpgang.com\/wp-json\/wp\/v2\/posts\/281\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.phpgang.com\/wp-json\/wp\/v2\/media\/282"}],"wp:attachment":[{"href":"https:\/\/www.phpgang.com\/wp-json\/wp\/v2\/media?parent=281"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.phpgang.com\/wp-json\/wp\/v2\/categories?post=281"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.phpgang.com\/wp-json\/wp\/v2\/tags?post=281"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}