empuxa / translation-manager
A smart translation manager for Laravel.
Fund package maintenance!
marcoraddatz
Requires
- php: ^8.1
- illuminate/config: ^9.33|^10.0|^11.0
- illuminate/contracts: ^9.33|^10.0|^11.0
- illuminate/database: ^9.33|^10.0|^11.0
- illuminate/queue: ^9.33|^10.0|^11.0
- illuminate/routing: ^9.33|^10.0|^11.0
- illuminate/support: ^9.33|^10.0|^11.0
- illuminate/view: ^9.33|^10.0|^11.0
- spatie/laravel-package-tools: ^1.0
Requires (Dev)
- laravel/pint: ^1.10
- orchestra/testbench: ^7.0|^8.0|^9.0
- phpunit/phpunit: ^9.6
- roave/security-advisories: dev-latest
- slevomat/coding-standard: ^8.8
This package is auto-updated.
Last update: 2024-07-08 02:01:46 UTC
README
Laravel Translation Manager
This package provides a web interface to manage your Laravel application translations. While the concept is heavily inspired by barryvdh/laravel-translation-manager, this package is a complete rewrite with a different approach to provide a better non-developer user experience:
- there is a non-editable default language, to separate development from translation
- it can export to sub-folders: for example, you can now have a
lang/en/dashboard/charts.php
file - all translation strings are on one page, that's based on Tailwind CSS
- it has (some) tests 🫣
However, currently there are also some disadvantages (feel free to contribute!):
- it does only read and export PHP files, no JSON
- vendor translations are not supported
- since all strings are on one page, big projects might have performance issues
Installation
This package requires Laravel 9.33+. You can install the package via composer:
composer require empuxa/laravel-translation-manager
Afterward, copy the vendor files:
php artisan vendor:publish --provider="Empuxa\TranslationManager\TranslationManagerServiceProvider"
Finally, run the migrations:
php artisan migrate
Don't forget to also update the config file config/translation-manager.php
to your needs!
Usage
Local Storage / Single Server Setup
By default, the translation manager is available at /translation-manager
. However, you can change the route in the config file. Before you can edit translations, you must also set up the output languages. The default language isn't editable to separate development and translation.
To push the translations into the database, you need to run the following command:
php artisan translation-manager:push-to-db
It's now possible to edit any language string via the web interface and save them to the database. If a language string already exists, it won't be overwritten. You can force that behavior by using the --force
flag.
Before you can use the translations in your application, you need to export them to PHP files that will get stored in the lang
folder. You can do that by running the following command:
php artisan translation-manager:pull-from-db
Cloud Storage / Multi Server Setup
The best way to use the translation manager in a cloud setup is to run a single server instance, where the translators can edit the translations. However, you might also want to push the translations to other environments. That's where cloud storage comes into play.
By using the translation-manager:push-to-storage
command, you can push any lang file to the storage disk defined in the config. With the translation-manager:pull-from-storage
command, you can then pull the translations from the storage disk.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
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.