PHP code example of lonely-lights / prosetta

1. Go to this page and download the library: Download lonely-lights/prosetta 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/ */

    

lonely-lights / prosetta example snippets


use LonelyLights\Prosetta\Models\Locale;

Locale::create([
    'locale_initials' => 'es',
    'english_name' => 'Spanish',
    'native_name' => 'Español',
    'translated' => true,
]);

$this->app->bind(TranslationDriver::class, MyTranslationDriver::class);

use LonelyLights\Prosetta\Enums\Ability;
use LonelyLights\Prosetta\Facades\Prosetta;

Prosetta::authorizeUsing(fn ($user, Ability $ability, ?string $locale): bool => $user->isAdmin());
bash
composer prosetta:install
php artisan migrate
bash
php artisan prosetta:sync                   # read your source lang files
php artisan prosetta:translate --sync       # draft every missing string
php artisan prosetta:review es              # see what's waiting in Spanish
php artisan prosetta:review es --approve-clean
php artisan prosetta:export                 # write lang/es/*.php