In this tutorial you will learn about the Laravel Google Translate Tutorial and its application with practical example.
In this article, I’ll show you how to use google translate package in laravel. It is easy to use and integrate google translate package in laravel.
.Laravel Google Translate is a Laravel package that is used to translate our files to other languages automatically using stichoza/google-translate-php or Google Translate API. Laravel Google Translate provides an artisan command to translate our localization files with the Google translation API.
Google Translate Installation In Laravel
Switch to your project directory and use the following artisan command to install Google Translate Package in your laravel application.
1 2 3 |
composer require tanmuhittin/laravel-google-translate php artisan vendor:publish --provider="Tanmuhittin\LaravelGoogleTranslate\LaravelGoogleTranslateServiceProvider" |
If you would like to use stichoza/google-translate-php you do not need an API key. If you would like to use Google Translate API, edit config/laravel_google_translate.php and add your Google Translate API key.
1 |
php artisan config:cache |
Now, run the following command to translate:
1 |
php artisan translate:files |