Laravel Translations UI provides a simple way to manage your app translations using a friendly UI, It allows you to add, edit, delete and export translations, and it also provides search functionality to find translations.
Features
- View & Create & Delete Translations.
- Manage your translation keys.
- Filter by translation keys or values,
- and more...
Installation
You may use the Composer package manager to install Laravel Translations UI into your Laravel project:
composer require outhebox/laravel-translations
After installing Laravel Translations UI, publish its assets using the following commands.
php artisan translations:install
Migrate your database before importing translations, you can use the following command.
php artisan migrate
Usage
Import your translations using the following command.
php artisan translations:import
If you want to import & overwrite all your previous translations, use the following command.
php artisan translations:import --fresh
Then you can access the translations UI, you can visit the /translations
in your browser, but first you need to login to your application if it's a production environment, and you can define who can access the translations UI in the configuration file, see for more details Authorization.
Exporting Translations
You can export your translations using the following command.
php artisan translations:export
Authorization
The Translations UI dashboard may be accessed at the /translations
route. By default, you will only be able to access this dashboard in the local environment. There is an authorization gate definition within your app/Providers/TranslationsServiceProvider
.php file. This authorization gate controls access to Translations UI Dashboard in non-local environments. You are free to modify this gate as needed to restrict access to your Translations UI installation:
protected function gate()
{
Gate::define('viewLaravelTranslationsUI', function ($user) {
return in_array($user->email, [
//
]);
});
}
For more details, please visit Github.
0 comments:
Post a Comment
Thanks