delta-solutions/translations

Store your spatie/laravel-translation-loader powered translations in columns instead of in a json field

1.1 2024-03-12 20:24 UTC

This package is auto-updated.

Last update: 2024-12-12 21:57:50 UTC


README

Translations

Latest Version on Packagist Total Downloads

Translations in columns loader

This package provides a migration and a model to extend the spatie/laravel-translation-loader so you can store your translations in columns instead of one json field. One column per locale.

Installation

You can install the package via composer:

composer require delta-solutions/translations

Follow the installation steps as explained in the Spatie docs https://github.com/spatie/laravel-translation-loader

Define the locales in the translation-loader.php config file, one locale per database column. This is used in the migration to create the database fields.

 'locales' => ['nl', 'fr', 'en', 'de', 'es']   

You can publish and run the migrations with:

php artisan vendor:publish --tag="translations-migrations"
php artisan migrate

This will create the fields in your database as specified in the locales array

example of table

Use the model from this package as the model for the spatie/laravel-translation-loader. This is configured via the model in the config. Change it to

 'model' => DeltaSolutions\Translations\Models\LanguageLine::class,

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.