<?php // plug-in 97: google translate
/** google翻譯
* 外掛程式說明:
* 外掛程式接受乙個字串,把它從一種語言翻譯到另一種語言。
* 若操作成功,則返回譯文,否則返回false。
* 它需要以下引數:
* $text 需要翻譯的文字
* $lang1 源語言
* $lang2 目標語言
*/// this is an executable example with additional code supplied
// to obtain just the plug-ins please click on the download link
echo '';
$text = "we hold these truths to be self-evident, that all " .
"men are created equal, that they are endowed by " .
"their creator with certain unalienable rights, that " .
"among these are life, liberty and the pursuit of " .
"are instituted among men, deriving their just powers " .
"from the consent of the governed.";
$from = 'english';
$to = 'german';
echo "original: $text
";echo "translated from $from to $to:
";$result = piphp_googletranslate($text, $from, $to);
if (!$result) echo "translation failed.";
else echo "translation: $result";
function piphp_googletranslate($text, $lang1, $lang2)
?>
Google翻譯介面 PHP API
google翻譯php介面 官成文 2009 03 28 注意 如果翻譯文字為utf 8編碼,則要刪去mb convert encoding函式 class google api translator public url public text 翻譯文字 public out 翻譯輸出 funct...
java 呼叫google翻譯
建立包translate,在這個包下建立類及emum如下 package translate 谷歌翻譯api定義的語言資訊。author lfd 改 2013 10 01 public enum googlelanguage public static googlelanguage fromstri...
google 翻譯python版本
進來,想搞個python 版本的google翻譯。看了下網頁,是乙個get請求,不禁大喜,深入研究後,發現這裡攜帶的引數其中包含乙個 tk 應該為token的縮寫吧,其用到搜尋的字元通過js函式的計算的到。可是未曾入坑js,看上去頗為燒腦。而我又是乙個求甚解的人,想要等了解js後再去突破。還有什麼其...