Skip to content

Translations With DB & UI For filament admin, Filament 3

License

Notifications You must be signed in to change notification settings

madviking/filament-translations

 
 

Repository files navigation

Screenshot of Login

Filament Translations

Manage your translation with DB and cache, you can scan your languages tags like trans(), __() from files, and get the string inside DB and translate them use UI. Also provides automatic, optional Google translation, language switcher and more.

Screenshots

Screenshot of list Screenshot of edit Screenshot of switcher

Installation

You can install the package via composer:

composer require 3x1io/filament-translations

Run migration:

php artisan vendor:publish --tag="filament-translations"
php artisan vendor:publish --tag="filament-translations-config"
php artisan migrate

In config/app.php (Laravel) or bootstrap/app.php (Lumen) you should replace Laravel"s translation service provider if you have one, or if you don"t, just add the following service provider aliases:

"providers" => [
        \io3x1\FilamentTranslations\FilamentTranslationsProvider::class

"aliases" => [
        "translator" => \io3x1\FilamentTranslations\Extensions\DbTranslator::class

Add Language Middleware

go to app/Http/Kernel.php and add new middleware to $middlewareGroups

    "web" => [
        //...
        \io3x1\FilamentTranslations\Http\Middleware\LanguageMiddleware::class,
    ],

go to config/filament.php and add middleware to middleware auth array

    "middleware" => [
        "auth" => [
            //...
            \io3x1\FilamentTranslations\Http\Middleware\LanguageMiddleware::class
        ],
        //...
    ];

and now clear cache

php artisan optimize:clear

To add the translations UI to your panel, add it to the resources method of your panel:

    public function panel(Panel $panel): Panel
    {
        return $panel
            ->resources([
                \io3x1\FilamentTranslations\Resources\TranslationResource::class,
            ])

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

Translations With DB & UI For filament admin, Filament 3

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%