protected function getQuery($text, $from, $to) { $params = array('format' => 'json', 'action' => 'ttmserver', 'sourcelanguage' => $from, 'targetlanguage' => $to, 'text' => $text); if (isset($this->config['service'])) { $params['service'] = $this->config['service']; } return TranslationQuery::factory($this->config['url'])->timeout($this->config['timeout'])->queryParamaters($params); }
protected function getQuery($text, $from, $to) { if (!isset($this->config['key'])) { throw new TranslationWebServiceException('API key is not set'); } $text = trim($text); $text = $this->wrapUntranslatable($text); $params = array('q' => $text, 'langpair' => "{$from}|{$to}", 'x-application' => "Translate " . TRANSLATE_VERSION . ")"); return TranslationQuery::factory($this->config['url'])->timeout($this->config['timeout'])->queryParamaters($params); }
protected function getQuery($text, $from, $to) { if (!isset($this->config['host'])) { throw new TranslationWebServiceException('Cxserver host not set'); } $text = trim($text); $text = $this->wrapUntranslatable($text); $url = $this->config['host'] . "/v1/mt/{$from}/{$to}/Apertium"; return TranslationQuery::factory($url)->timeout($this->config['timeout'])->postWithData($text); }
protected function getQuery($text, $from, $to) { if (!isset($this->config['key'])) { throw new TranslationWebServiceException('API key is not set'); } # http://api.yandex.com/translate/doc/dg/reference/translate.xml if (strlen($text) > 10000) { throw new TranslationWebServiceException('Source text too long'); } $service = $this->service; $text = trim($text); $text = $this->wrapUntranslatable($text); return TranslationQuery::factory($this->config['url'])->timeout($this->config['timeout'])->postWithData(array('key' => $this->config['key'], 'text' => $text, 'lang' => "{$from}-{$to}", 'format' => 'html')); }
protected function getQuery($text, $from, $to) { if (!isset($this->config['key'])) { throw new TranslationWebServiceException('API key is not set'); } $text = trim($text); $text = $this->wrapUntranslatable($text); $params = array('text' => $text, 'from' => $from, 'to' => $to, 'appId' => $this->config['key']); $url = 'http://api.microsofttranslator.com/V2/Http.svc/Translate?'; return TranslationQuery::factory($this->config['url'])->timeout($this->config['timeout'])->queryParamaters($params); }
protected function getQuery($text, $from, $to) { if (!isset($this->config['key'])) { throw new TranslationWebServiceException('API key is not set'); } $text = trim($text); $text = $this->wrapUntranslatable($text); $params = array('q' => $text, 'key' => $this->config['key'], 'keyfrom' => $this->config['keyfrom'], 'type' => 'data', 'doctype' => 'xml', 'version' => '1.1'); $url = 'http://fanyi.youdao.com/openapi.do?'; return TranslationQuery::factory($this->config['url'])->timeout($this->config['timeout'])->queryParamaters($params); }