Search by

lonely-lights / prosetta

lonelylights

Translate a Laravel app with AI, review each language, and write the approved text back into your lang files.

Package info

github.com/lonely-lights/prosetta

pkg:composer/lonely-lights/prosetta

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 1

v0.1.0 2026-09-26 21:40 UTC

This package is auto-updated.

Last update: 2026-09-26 22:20:48 UTC


README

Tests Latest version License

Translate a Laravel app with AI, and keep people in charge of what goes live.

You write your app's text in one language, in the lang files you already have. Prosetta drafts every other language with an AI model you choose, lets reviewers approve, edit or reject each draft, and writes the approved text back into your lang files.

  • Your source files stay yours. Prosetta reads your English (or whichever source language you use) and never writes to it.
  • Any AI provider. You plug in a small driver class; Prosetta ships no AI client of its own.
  • Checked drafts. Every draft is checked for broken placeholders, plurals and HTML, and gets one retry with the problems explained.
  • Per-language review. Decide who may translate or review each language, with one callback.
  • Runs on its own. An optional background cycle keeps every language current as your English changes, and stops cleanly when a provider is down or a budget runs out.
  • Headless. There is no built-in admin screen. Your app calls Prosetta's services, so the review UI fits your app.

Requirements

  • PHP 8.3 or later
  • Laravel 12 or 13
  • A queue worker, for translating in the background (optional for small runs)

Install

composer require lonely-lights/prosetta
php artisan prosetta:install
php artisan migrate

prosetta:install publishes config/prosetta.php and Prosetta's migrations. See Installation for what they create and for apps that already have a locales table.

Quick start

1. Add a language to translate into. Each target language is a row in prosetta_locales. Its code must match the lang folder name exactly (es, zh-CN, en_GB):

use LonelyLights\Prosetta\Models\Locale;

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

2. Plug in an AI driver. Write a class that implements LonelyLights\Prosetta\Contracts\TranslationDriver and bind it in a service provider. AI drivers has a complete example using laravel/ai.

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

3. Say who may review. Without this, Prosetta allows everything in your local environment and nothing anywhere else:

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

Prosetta::authorizeUsing(fn ($user, Ability $ability, ?string $locale): bool => $user->isAdmin());

4. Translate.

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

Commit the new lang files like any other change. From here, the workflow guide explains each step, and background mode shows how to let a scheduled cycle do it for you.

Documentation

Guide Covers
Installation Tables, languages, upgrading an existing locales table
The workflow Sync, translate, review, export; every command; access control
AI drivers Writing a driver, reporting provider errors, testing with the fake driver
Background mode The automatic cycle, language settings, glossaries, spelling variants like en_GB
Resilience and costs Outages, circuits, token budgets, prices and cost reports
Building a review UI Queries and actions for your own admin screens
Translating database content Translating model fields, not just lang files
Member reports Letting members flag a bad translation
Reviewing in production Approving on the live site and pulling it back into your lang files

Testing

composer test

To test your own integration without calling an AI, bind LonelyLights\Prosetta\Testing\FakeTranslationDriver. See AI drivers.

Changelog

See CHANGELOG.md.

Contributing and security

See CONTRIBUTING.md. To report a security problem, follow SECURITY.md rather than opening a public issue.

License

MIT. See LICENSE.