2012-04-10 26 views
0

如何使用谷歌翻译在英语中代表所有语言的单词的含义?例如,如果输入if Lion(英文),那么输出应该是如何使用谷歌翻译在所有语言中获取单词的含义?

leon(Spanish) 
lion(French) 
singam(Tamil) 
simhah(Hindi) 

等等。

+0

来源:http://code.google.com/apis/language/translate/v2/getting_started.html “谷歌翻译API v2是现在只能作为付费服务使用,而且您的应用程序每天可以提供的请求数量有限。“你愿意为API付费吗?如果不是,你可能会关闭这个问题。 – Alain 2012-04-10 18:13:25

+0

确定Alain我准备付款 – Stranger 2012-04-10 18:19:42

+0

好的,接下来 - 您使用的是哪种编程语言。你没有用任何语言标记你的问题。答案根据您是否使用C++,C#,Java,VB.Net,Go,Google Web Toolkit,JavaScript,Objective C,PHP,Python或Ruby而有所不同。 – Alain 2012-04-10 18:21:37

回答

1

here使用例如:

<?php 
require_once '../../src/apiClient.php'; 
require_once '../../src/contrib/apiTranslateService.php'; 

$client = new apiClient(); 
$client->setApplicationName('Google Translate PHP Starter Application'); 

// Visit https://code.google.com/apis/console?api=translate to generate your 
// client id, client secret, and to register your redirect uri. 
// $client->setDeveloperKey('insert_your_developer_key'); 
$service = new apiTranslateService($client); 

$langs = $service->languages->listLanguages(); 
print "<h1>Languages</h1><pre>" . print_r($langs, true) . "</pre>"; 

$translations = $service->translations->listTranslations('Hello', 'hi'); 
print "<h1>Translations</h1><pre>" . print_r($translations, true) . "</pre>"; 

listTranslations为您提供您所寻求的信息。

我还建议阅读文档,因为它是短暂的:code.google.com/apis/language/translate/v2/using_rest.html

相关问题