【发布时间】:2016-02-22 21:00:03
【问题描述】:
我使用https://github.com/google/google-api-php-client 进行翻译。
当我尝试时
print_r($translation->listTranslations( "John go home", "es" ));
我明白了
Google_Service_Translate_TranslationsListResponse Object
(
[collection_key:protected] => translations
[internal_gapi_mappings:protected] => Array
(
)
[translationsType:protected] => Google_Service_Translate_TranslationsResource
[translationsDataType:protected] => array
[modelData:protected] => Array
(
[data] => Array
(
[translations] => Array
(
[0] => Array
(
[translatedText] => John ir a casa
[detectedSourceLanguage] => en
)
)
)
)
[processed:protected] => Array
(
)
)
但是当我尝试使用 getTranslations() 函数获取翻译时 - 我得到了空数组。请指教!
【问题讨论】:
标签: php google-api-php-client google-translate