uocnv / text-translate
使用谷歌翻译进行文本翻译
dev-master
2020-09-11 11:22 UTC
Requires
- php: ^7.2
- laravel/framework: ^7.0
This package is auto-updated.
Last update: 2024-09-10 15:36:50 UTC
README
该包使用 curl 创建请求到 https://translate.google.com/m 进行翻译并获取结果。
创建者:Nguyễn Văn Ước
安装
composer require uocnv/text-translate
-
路径: {yourdomain}/text-translate/translate
-
配置
php artisan vendor:publish --provider="Uocnv\TextTranslate\TextTranslateServiceProvider" --tag="config"
"translate_target" => "vi" - 是要翻译成的语言。
使用方法
use Uocnv\TextTranslate\TextTranslate;
$gt = new TextTranslate();
echo $gt->translate($text, $to, $from='', $cache = false);