name-translation
Transliterate the names in your content, don’t translate., (*1)
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)., (*2)
After downloading the package, you need to set your API KEYs for the previously mentioned connections in the configuration file (config/name-translation.php)., (*3)
Also, you need to assign them in the test file (tests/NameTranslation/TranslatioTest) if you want to run the used tests in the package., (*4)
By default,the translation will be held with the Rosette Connection from English to Arabic., (*5)
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)., (*6)
Prerequisites
The requirements for this package are:, (*7)
php: ">=5.6.4",
illuminate/support: "~5.0"
Also for the tests,you need to have the following in the require-dev:, (*8)
"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:, (*9)
brew install < php-version >-xdebug, (*10)
eg., (*11)
brew install php56-xdebug, (*12)
Installing
Install the package via composer:, (*13)
composer require yamsafer/name-translation
Register the ServiceProvider in config/app.php, (*14)
'providers' => [
// [...]
NameTranslation\TranslationServiceProvider::class,
],
You may also register the NameTranslation Facade:, (*15)
'aliases' => [
// [...]
'NameTranslation' => NameTranslation\Facades\NameTranslationFacade::class,
],
Within your laravel project, when you execute Laravel's vendor:publish command, the configuration will be published., (*16)
Run Tests
You can run the tests using the following command under the previously mentioned
specifications:, (*17)
vendor/bin/phpunit tests/NameTranslation/TranslationTest.php
Within your project you must assign the right directory as:, (*18)
vendor/bin/phpunit yamsafer/name-translation/tests/NameTranslation/TranslationTest.php