Posts Tagged ‘翻译

< ?php /** * Google翻译的API */ class Google_translate_API { public $out = ""; public $text = ""; public $opts = array("text" => "", "language_pair" => ""); function setValues($text,$fromLanguage,$toLanguage) { if($text != "") $this->opts["text"] = $text; if($fromLanguage != "" && $toLanguage != "") $this->opts["language_pair"] = $fromLanguage."|".$toLanguage; } function translate() { $this->out = ""; if (strlen($this->opts['text']) > 500) { $str1 = cSubStr($this->opts['text'],0,480); $str2 = cSubStr($this->opts['text'],480,(strlen($this->opts['text']-480))); $google_translator_url1 = "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=".urlencode($str1)."&langpair=".urlenco ...

分类

归档

ipv6 ready