PHP code example of joggapp / laravel-google-translate
1. Go to this page and download the library: Download joggapp/laravel-google-translate library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
joggapp / laravel-google-translate example snippets
return [
/*
|----------------------------------------------------------------------------------------------------
| The ISO 639-1 code of the language in lowercase to which the text will be translated to by default.
|----------------------------------------------------------------------------------------------------
*/
'default_target_translation' => 'en',
/*
|-------------------------------------------------------------------------------
| Path to the json file containing the authentication credentials.
|
| The process to get this file is documented in a step by step detailed manner
| over here:
| https://github.com/JoggApp/laravel-google-translate/blob/master/google.md
|-------------------------------------------------------------------------------
*/
'api_key' => env('GOOGLE_TRANSLATE_API_KEY'),
];
GoogleTranslate::detectLanguage('Hello world'): array
GoogleTranslate::detectLanguage(['Hello world', 'Laravel is the best']);
// Returns multi-dimensional array containing result set for all the array elements.
// GoogleTranslate::translate($input, $from = null, $to = null, $format = 'text'): array
GoogleTranslate::translate('Hello world'): array
GoogleTranslate::translate(['Hello world', 'Laravel is the best']);
// Returns multi-dimensional array containing result set for all the array elements.