A Natural language translation SD..
目前已支持有道平台
$ composer require aliliin/language-translation dev-master -vvv
require_once __DIR__ . '/vendor/autoload.php';
use Aliliin\LanguageTranslation\Translation;
$config = [
'provider' => 'youdao',
'youdao' => [
'provider' => [
'app_key' => 'xxxxxxx',
'sec_key' => 'xxxxxxxx',
],
'language' => [
'from' => 'zh-CHS',
'to' => 'en',
]
],
];
$translation = new Translation($config);
$res = $translation->translation('高兴');
示例:
[
"happy",
]
translation(string $language)
-
$language
- 需要翻译的词语
MIT