lpuddu/laravel-translations-dashboard

A panel for managing database translations in Laravel.

v1.1.3 2019-04-24 15:13 UTC

README

Latest Version on Packagist Total Downloads

This package is a full-featured translations dashboard for laravel 5.7+.

You will have a ready-to-use dashboard to manage multilingual translation keys, to be loaded in your website with the Laravel native helpers (__(), trans() and @lang()).

The package combines the best features of two popular packages, namely spatie\laravel-permission and Waavi/translation.

Installation

Via Composer

composer require lpuddu/laravel-translations-dashboard

Usage

Once installed, publish the required files (assets folder and dependencies migrations) by running

php artisan translations-dashboard:init

You can also customize the views and the config, by changing the tag when you publish (use views and config as tags)

When published, the config/laravel-translations-dashboard.php config file contains:

return [
    /**
     * The prefix applied to all the routes, eg. /translations/home
     */
    'prefix' => 'translations',

    /**
     * The list of middlewares that all routes should use.
     * You can use this to authenticate users into the dashboard via the appropriate middleware.
     */
    'middlewares' => ['web', 'auth']
];

Remove your config cache:

php artisan config:clear

Execute the database migrations:

php artisan migrate

By default, the package adds four permissions (manage-languages, manage-pages, manage-settings, translate) and two roles (admin and translator). Without permissions, you will only be able to login into the dashboard without doing much.

Make sure that your user has a HasRoles trait, then create a user with the translator or admin role to start working.

To make an admin, just use $user->assignRole('admin'). The change will be reflected immediately on your database. Check the spatie\laravel-permission documentation to explore more possibilities.

Security

If you discover any security related issues, please use the issue tracker on github or email me at info__at__lucapuddu.com

Credits

License

MIT. Please see the license file for more information.