php-translation / translator
翻译服务
1.2.0
2021-03-26 18:20 UTC
Requires
- php: ^7.2 || ^8.0
- php-http/client-implementation: ^1.0
- php-http/discovery: ^1.7
- php-http/httplug: ^1.0 || ^2.0
- psr/log: ~1.0
Requires (Dev)
- nyholm/nsa: ^1.1
- nyholm/psr7: ^1.2
- php-http/curl-client: ^1.0 || ^2.0
- php-http/message: ^1.8
- phpunit/phpunit: ^8.4
README
可以用于字符串翻译的服务
安装
首先,您需要安装一个 HTTP 客户端。请阅读 HTTPlug 快速入门。客户端安装后,您可以通过运行以下命令使用 composer 安装此包:
composer require php-translation/translator
简介
$translator = new Translator(); $translator->addTranslatorService(new GoogleTranslator('api_key')); echo $translator->translate('apple', 'en', 'sv'); // "äpple"