novius / laravel-translation-loader
Store your language lines in the database, yaml or other sources
Installs: 20 518
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 6
Open Issues: 1
pkg:composer/novius/laravel-translation-loader
Requires
- php: ^8.2
- laravel/framework: ^9.0|^10.0|^11.0|^12.0
- lorisleiva/laravel-actions: ^2.7
Requires (Dev)
- larastan/larastan: ^v2.9.14|^3.1
- laravel/pint: ^1.10
- orchestra/testbench: ^7.0|^8.0|^9.0|^v10.0
- phpunit/phpunit: ^9.3.3|^10.5|^11.5|^12.5
README
This package is an adaptation of spatie/laravel-translation-loader
WARNING: this package is currently in development.
Features added
- Translations namespace compatibility ;
- Console commands to synchronize translations from files to DB;
- Manage differences between file translations and DB translations;
- Detect orphan translations (translations in DB but no longer in files);
- Identify "dirty" locales (DB translation different from file translation);
- Actions to sync specific translations (File to DB or DB to file);
Requirements
- PHP >= 8.2
- Laravel Framework >= 9.0
NOTE: These instructions are for Laravel >= 9.0. If you are using prior version, please see the previous version's docs.
Installation
composer require novius/laravel-translation-loader:dev-master
In config/app.php (Laravel) you should replace Laravel's translation service provider
Illuminate\Translation\TranslationServiceProvider::class,
by the one included in this package:
Novius\TranslationLoader\TranslationServiceProvider::class,
Run migrations:
php artisan migrate
Publish languages' files:
php artisan vendor:publish --provider="Novius\TranslationLoader\TranslationServiceProvider" --tag="lang"
Optionally, you could publish the config file using this command.
php artisan vendor:publish --provider="Novius\TranslationLoader\TranslationServiceProvider" --tag="config"
Commands
# Synchronise translations from files to DB php artisan translations:sync # Synchronise and delete translations from DB that are not in files anymore php artisan translations:sync --clean # Clear DB translations + re-import them php artisan translations:reset
Lint
Run php-cs with:
composer run-script lint
Contributing
Contributions are welcome! Leave an issue on Github, or create a Pull Request.
Licence
This package is under MIT Licence.