• Translation Manager
  • Translation Manager

Translation Manager

Plugin information

by Kenepa

Admin panel

Introducing Filament translation manager, a tool that lets you manage, preview, and sync translations with your language files in the dashboard.

Support

#translation-manager on Discord

Views

10241

License

MIT

Documentation

Translation Manager

filament-shield-art

Latest Version on Packagist Total Downloads

Introducing our Filament translation management tool, which allows you to easily manage, preview, and sync translations with your language files all within your Filament admin dashboard. Say goodbye to relying on developers to edit language files and streamline your localization workflow today.

filament-shield-art

Installation

You can install the package via composer:

composer require kenepa/translation-manager

You can run the following command to publish the configuration file:

php artisan vendor:publish --tag=translation-manager-config

This package uses spatie/laravel-translation-loader, publish their migration file using:

php artisan vendor:publish --provider="Spatie\TranslationLoader\TranslationServiceProvider" --tag="migrations"

You have to update the migration file to the following:

Schema::create('language_lines', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('group')->index();
$table->string('key')->index();
$table->json('text')->default('[]');
$table->timestamps();
});

Finally, run the migration.

(Optional) Enable the middleware

If you want to make use of the language switcher, you have to enable the middleware.
First in app/Http/Kernel.php under the 'web' middleware group:

protected $middlewareGroups = [
'web' => [
// ...
// Add the middleware to the array
\Kenepa\TranslationManager\Http\Middleware\SetLanguage::class,
]
];

Secondly in config/filament.php:

'middleware' => [
'auth' => [/* ... */],
'base' => [
// ...
// Add the middleware to the array
\Kenepa\TranslationManager\Http\Middleware\SetLanguage::class,
]
]

Authorization

By default, the translation manager cannot be used by anyone. You need to define the following gate in your AppServiceProvider boot method:

Gate::define('use-translation-manager', function (?User $user) {
// Your authorization logic
return $user !== null && $user->hasRole('admin');
});

Configuration

available_locales

Determines which locales your application supports. For example:

'available_locales' => [
['code' => 'en', 'name' => 'English', 'emoji' => '🇬🇧'],
['code' => 'nl', 'name' => 'Nederlands', 'emoji' => '🇳🇱'],
['code' => 'de', 'name' => 'Deutsch', 'emoji' => '🇩🇪']
]

language_switcher

Enable or disable the language switcher feature. This allows users to switch their language - disable if you have your own implementation.
Language Switcher

Usage

Once installed, the Translation Manager can be accessed via the Filament sidebar menu. Simply click on the "Translation Manager" link to access the translation management screen.

License

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