如何使用谷歌翻译获取所有语言中单词的含义


How get the meaning of a word in all language using google translate?

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

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

等等。

使用此处的示例:

<?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