awkaw/laravel-translations
最新稳定版本:2.2.0
Composer 安装命令:
composer require awkaw/laravel-translations
包简介
Translate service for Laravel
README 文档
README
Installation
The library can be installed with Composer and is available on packagist under awkaw/laravel-translations:
composer require awkaw/laravel-translations:^2.1
Run the migrations
php artisan migrate
Install Google Chrome browser
docker run -p 9222:9222 --name your_name_for_image --restart always -d awkaw/chrome
Usage
Usage GoogleChromeBrowser
use LaravelTranslations\Services\GoogleTranslateService;
use LaravelTranslations\Services\GoogleTranslate\Providers\GoogleChromeBrowser;
$sourceLocale = 'en';
$targetLocale = 'ru';
$googleChromeAddress = '127.0.0.1:9222'; // enter your address
$sourceText = 'Test translation';
$options = [
"provider" => GoogleChromeBrowser::class,
"googleChromeAddress" => $googleChromeAddress,
"debug" => false,
];
$service = new GoogleTranslateService($sourceLocale, $targetLocale, $options);
$resultText = $service->translate($sourceText);
统计信息
- 总下载量: 2.9k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2020-03-26