spatie/laravel-translatable
Add multilingual fields to Eloquent models using a simple HasTranslations trait. Store translations as JSON on the model (no extra tables). Set/get translations per locale, switch app locale, fetch all translations, and even translate nested JSON keys via -> notation.
Right after calling setTranslation the Spatie\Translatable\Events\TranslationHasBeenSetEvent-event will be fired.
This is how that event looks like:
namespace Spatie\Translatable\Events;
class TranslationHasBeenSetEvent
{
public function __construct(
public mixed $model,
public string $key,
public string $locale,
public mixed $oldValue,
public mixed $newValue,
) {
//
}
}
How can I help you explore Laravel packages today?