1. Go to this page and download the library: Download tonydev/lara-glot 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/ */
tonydev / lara-glot example snippets
'glossary' => [
// Never translated — byte-identical in every language.
// Works with all five drivers.
'protected_terms' => ['LaraGlot', 'Acme Cloud'],
// Forced translations per target locale.
// Applied by the LLM drivers (anthropic, openai, ollama).
'terms' => [
'checkout' => ['de' => 'Kasse', 'fr' => 'paiement'],
],
],
use Spatie\Translatable\HasTranslations;
use Tonydev\LaraGlot\Traits\HasSmartTranslations;
class Page extends Model
{
use HasTranslations;
use HasSmartTranslations;
public $translatable = ['title', 'body', 'seo_title', 'seo_description'];
}
'models' => [
\App\Models\Page::class,
],
use Tonydev\LaraGlot\LaraGlotPlugin;
public function panel(Panel $panel): Panel
{
return $panel->plugin(LaraGlotPlugin::make());
}
use Tonydev\LaraGlot\Services\TranslationService;
TranslationService::extend('my-engine', fn () => new MyEngineDriver());
'prompt' => 'Translate the JSON array from {source} to {target}. ... your rules ...',