Introduction | Installation | Usage | Authorization | Upgrade | Roadmap | Changelog
Laravel Translations UI is a package that provides a simple and friendly user interface for managing translations in a Laravel app. With this package, you can easily add, edit, delete, and export translations, and use the search function to find specific translations.
- View, create, and delete translations
- Manage translation keys
- Filter by translation keys or values
- Import and export translations
- Search function to find specific translations
- and more...
To install Laravel Translations UI in your Laravel project, run the following command:
composer require outhebox/laravel-translations
After installing the package, you'll need to publish its assets by running the following command:
php artisan translations:install
Before you can import translations, you'll need to migrate your database. Run the following command to do so:
php artisan migrate
To import your translations, run the following command:
php artisan translations:import
To import and overwrite all previous translations, use the following command:
php artisan translations:import --fresh
To access the translations UI, visit /translations in your browser. If you are using a production environment, you will need to login to your application before accessing the translations UI.
You can customize the authorization gate in the configuration file to control access to the translations UI in non-local environments. For more information, see for more details Authorization.
To export your translations, run the following command:
php artisan translations:export
By default, the Translations UI dashboard can only be accessed in the local environment. The authorization gate in the app/Providers/TranslationsServiceProvider.php
file controls access to the Translations UI dashboard in non-local environments. You can modify this gate as needed to restrict access to your Translations UI installation.
To customize the authorization gate, you can define a closure in the gate method of the TranslationsServiceProvider class:
protected function gate()
{
Gate::define('viewLaravelTranslationsUI', function ($user) {
return in_array($user->email, [
// return true or false based on your authorization logic
]);
});
}
When upgrading to a new major version of Laravel Translations UI, it's important that you carefully review the upgrade guide.
In addition, when upgrading to any new Translations UI version, you should re-publish Translations UI assets:
php artisan translations:publish
To keep the assets up-to-date and avoid issues in future updates, you may add the translations:publish command to the post-update-cmd scripts in your application's composer.json file:
{
"scripts": {
"post-update-cmd": [
"@php artisan translations:publish --ansi"
]
}
}
- Add tests.
- Improve the UI.
- Vendor translations support.
- Google Translate API integration.
- Invite collaborators to manage translations.
- Add revision history.
- Add more features.
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Thank you for considering supporting the development of this package! If you'd like to contribute, you can buy me a coffee or sponsor me to help keep me motivated to continue improving this package. You can also support the project by starring ⭐ the repository.
To buy me a coffee, click the button below:
The MIT License (MIT). Please see License File for more information.