PHP code example of backstage / laravel-translations
1. Go to this page and download the library: Download backstage/laravel-translations 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/ */
backstage / laravel-translations example snippets
use EchoLabs\Prism\Enums\Provider;
[
'scan' => [
'paths' => [
base_path(),
],
'files' => [
'*.php',
'*.blade.php',
'*.json',
],
'functions' => [
'trans',
'trans_choice',
'Lang::transChoice',
'Lang::trans',
'Lang::get',
'Lang::choice',
'@lang',
'@choice',
'__',
],
],
'translators' => [
'default' => env('TRANSLATION_DRIVER', 'google-translate'),
'drivers' => [
'google-translate' => [
// no options
],
'ai' => [
'provider' => Provider::OpenAI, // Example provider
'model' => 'text-davinci-003', // Example model
'system_prompt' => 'You are an expert mathematician who explains concepts simply. The only thing you do it output what i ask. No comments, no extra information. Just the answer.', // Example system prompt
],
],
],
];
bash
php artisan translations:languages:add nl Nederlands
translations:languages:add en English
translations:languages:add fr-BE Français // French specifically for Belgians