PHP code example of worksome / translator
1. Go to this page and download the library: Download worksome/translator 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/ */
worksome / translator example snippets
$translator = new Worksome\Translator\TranslationManager();
$translator->driver('google_cloud_translate')->translate('Text to translate', 'en', 'da'); // TranslationDTO
$translator->driver('google_cloud_translate')->detectLanguage('Text to detect'); // DetectedLanguageDTO
// Via the Facade
use Worksome\Translator\Facades\Translator;
Translator::translate(''); // Use the default driver
Translator::driver('google_cloud_translate')->translate('', 'en', 'da'); // Use a custom driver
bash
php artisan vendor:publish --tag="translator-config"