Google's online translation interface program needs to be put on its own webpage like google Translate. How can I write this interface in translate.google.cn? 1. I went to google's house to flip it. The results are all in English. You can't understand it. 2. I searched online and found none of them. Please provide usable. 3. Only one C ++ written interface is not tested. My PHP page is used. Evaluate the PHPorJS interface. Google online translation interface program
You need to put it on your webpage like Google Translate.
Http://translate.google.cn/
How to write this interface?
1. I went to google's house to flip it. The results are all in English. You can't understand it.
2. I searched online and found none of them. Please provide usable.
3. Only one C ++ written interface is not tested. My PHP page is used. Evaluate the PHP or JS interface.
4: no points, all invested.
------ Solution --------------------
Http://code.google.com/intl/en/apis/language/translate/v2/getting_started.html
In this article, it is not difficult to understand the meaning ..
Call: https://www.googleapis.com/language/translate/v2? Key = INSERT-YOUR-KEY & q = hello % 20 world & source = en & target = zh-CN
The returned data is in JSON format.
GET parameters:
Key needs to be applied to Google
Q. text to be translated
Source specifies the source language
Target specifies the target language
Example:
HTML code
Translate API Example Hello world
Script function translateText (response) {document. getElementById ("translation"). innerHTML + ="
"+ Response. data. translations [0]. translatedText;} script var newScript = document. createElement ('script'); newScript. type = 'text/javascript '; var sourceText = escape (document. getElementById ("sourceText "). innerHTML); var source = 'https: // www.googleapis.com/language/translate/v2? Key = INSERT-YOUR-KEY & source = en & target = de & callback = translateText & q = '+ sourceText; newScript. src = source; // When we add this script to the head, the request is sent off. document. getElementsByTagName ('head') [0]. appendChild (newScript); script
------ Solution --------------------
Get it, Yahoo YQL query GOOGLE translation
The default language is translated into English in other languages. To replace the target language with the following target = "en"
// If it is changed to zh-cn, other languages are translated into simplified Chinese.
PHP code
YUI3 Google Translate YQL