yamsafer/name-translation
Composer 安装命令:
composer require yamsafer/name-translation
包简介
package to translate names with one of the two ways 1.Rosette 2.Google Translate
README 文档
README
Transliterate the names in your content, don’t translate.
Getting Started
This package is constructed to allow users to translate names from a source language to a target language with two possible connections (Rosette ,Google Translate).
After downloading the package, you need to set your API KEYs for the previously mentioned connections in the configuration file (config/name-translation.php).
Also, you need to assign them in the test file (tests/NameTranslation/TranslatioTest) if you want to run the used tests in the package.
By default,the translation will be held with the Rosette Connection from English to Arabic.
You can use the main method translate($name, $source, $target), which take three parameters as $name => The given name that you want to translate (must be given) $source => The source language (optional _default = arabic); $target => The source language (optional _default = english).
Prerequisites
The requirements for this package are:
php: ">=5.6.4",
illuminate/support: "~5.0"
Also for the tests,you need to have the following in the require-dev:
"phpunit/phpunit": "5.0.*"
Also, the test configuration includes the code coverage which can be enabled if you have Xdebug in your system. Xdebug can be installed via brew install:
brew install < php-version >-xdebug
eg.
brew install php56-xdebug
Installing
Install the package via composer:
composer require yamsafer/name-translation
Register the ServiceProvider in config/app.php
'providers' => [
// [...]
NameTranslation\TranslationServiceProvider::class,
],
You may also register the NameTranslation Facade:
'aliases' => [
// [...]
'NameTranslation' => NameTranslation\Facades\NameTranslationFacade::class,
],
Within your laravel project, when you execute Laravel's vendor:publish command, the configuration will be published.
Run Tests
You can run the tests using the following command under the previously mentioned specifications:
vendor/bin/phpunit tests/NameTranslation/TranslationTest.php
Within your project you must assign the right directory as:
vendor/bin/phpunit yamsafer/name-translation/tests/NameTranslation/TranslationTest.php
yamsafer/name-translation 适用场景与选型建议
yamsafer/name-translation 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10.79k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2017 年 08 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 yamsafer/name-translation 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 yamsafer/name-translation 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 10.79k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2017-08-22