aliliin / language-translation
A Natural language translation SDK.
v1.0
2020-06-02 02:23 UTC
Requires
- guzzlehttp/guzzle: ^6.5
- mockery/mockery: ~1.3
- phpunit/phpunit: ~7
This package is auto-updated.
Last update: 2024-05-11 11:42:59 UTC
README
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
- 需要翻译的词语
License
MIT