Recommend this page to a friend! |
Download |
Info | Documentation | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not yet rated by the users | Total: 33 | All time: 11,047 This week: 74 |
Version | License | PHP version | Categories | |||
yandex-language-tran 1.0.0 | Freeware | 7 | Web services, Language, PHP 7 |
Description | Author | ||||||||
This package can translate application texts using Yandex API. |
|
Recommendation for a PHP class to translate text
Translate a word taken from a form
Package to translate message into different languages.
Install via composer
composer require decodewebin/yandex-language-translate
Get Yandex language translate FREE api key from here:
https://tech.yandex.com/translate/
Add variables in ENV file
YANDEX_TRANSLATE_ENDPOINT=https://translate.yandex.net/api/v1.5/tr.json
and
YANDEX_TRANSLATE_API_KEY=YOUR_API_KEY_HERE
Run Command
php artisan vendor:publish --tag=yandex_config
Run Database Migration Command
php artisan migrate
and
Run Language Seeder Command
php artisan db:seed --class="Decodewebin\YandexTranslate\Database\Seeds\LanguageSeeder"
Open localhost:8000/translate
You can use translation endpoint in your application too.
Go to web.php and add the following code
`Route::get('/test-translate',function (){
dd(\Decodewebin\YandexTranslate\Static_Functions\Yandex::translate('Hello World','en','pt'));
});`
or in your controller, add USE the package functions like it
`use Decodewebin\YandexTranslate\Static_Functions\Yandex;
`
`class YourController extends Controller
`
{
` public function your_function() `
`{`
` dd(Yandex::translate("Hello World","en","ru");) `
`}`
}
Yandex::translate(STRING_TO_TRANSLATE ORIGINAL_LANGUAGE_CODE, LANGUAGE_CODE_TO_TRANSLATE_INTO)
This function returns a json object as follows
{
` "translated": "Olá Mundo", ` ` "source_language_code": "en" `
}
If you liked this package then do follow me on
Files (13) |
File | Role | Description | ||
---|---|---|---|---|
src (3 files, 5 directories) | ||||
CODE_OF_CONDUCT.md | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
LICENSE | Lic. | License text | ||
README.md | Doc. | Documentation |
Files (13) | / | src |
File | Role | Description | ||
---|---|---|---|---|
database (2 directories) | ||||
Http (1 directory) | ||||
Models (1 file) | ||||
Static_Functions (1 file) | ||||
views (1 file) | ||||
routes.php | Example | Example script | ||
YandexTranslateServiceProvider.php | Class | Class source | ||
yandex_config.php | Aux. | Auxiliary script |
Files (13) | / | src | / | database | / | migrations |
File | Role | Description |
---|---|---|
2019_07_23_052548_...languages_table.php | Class | Class source |
Files (13) | / | src | / | Http | / | Controllers |
File | Role | Description |
---|---|---|
YandexTranslateController.php | Class | Class source |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
yandex-language-tran-2019-07-25.zip 20KB | |
yandex-language-tran-2019-07-25.tar.gz 17KB | |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
User Comments (2) | ||||||||
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.