2012-04-10 81 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

相關問題