Nice to meet you, we're Vormkracht10
Hi! We are a web development agency from Nijmegen in the Netherlands and we use Laravel for everything: advanced websites with a lot of bells and whitles and large web applications.
You can install the package via composer:
composer require backstage/laravel-translations
You can publish and run the migrations with:
php artisan vendor:publish --provider="Backstage\Translations\Laravel\TranslationServiceProvider"
php artisan migrate
This is the contents of the published config file:
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
],
],
],
];
If you have choosen the AI driver, please read the Prism documentation on how to configure providers.
If you want to add a language use the following command:
php artisan translations:languages:add {locale} {label}
For example:
php artisan translations:languages:add nl Nederlands
translations:languages:add en English
translations:languages:add fr-BE Français // French specifically for Belgians
The command can also be used without in-command-line parameters
To scan for translations within your Laravel application, use the following command:
php artisan translations:scan
To translate the scanned translations, use the following command:
php artisan translations:translate
{--all : Translate language strings for all languages}
{--code= : Translate language strings for a specific language}
{--update : Update and overwrite existing translations}
For example:
php artisan translations:translate --code=nl
php artisan translations:translate --code=en
php artisan translations:translate --code=fr-BE --update // overwrite existing translations
php artisan translations:translate // translate all languages
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.