zakariatlilani/translation-manager

Manage your application's translation in Filament.

Maintainers

Package info

github.com/ZakariaTlilani/translation-manager

Homepage

pkg:composer/zakariatlilani/translation-manager

Transparency log

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.1 2026-06-28 16:10 UTC

This package is auto-updated.

Last update: 2026-06-28 16:13:48 UTC


README

This package uses spatie/laravel-translation-loader, Make sure your migration is done correctly. This package uses phpfilament v5, make sure you have php 8.2 or greater.

Installation

You can install the package via composer:

composer require zakariatlilani/translation-manager

Plugin Configuration

use ZakariaTlilani\TranslationManager\TranslationManagerPlugin;

TranslationManagerPlugin::make()
    ->availableLocales([
        ['code' => 'en', 'name' => 'English', 'flag' => 'gb'],
        ['code' => 'fr', 'name' => 'Français', 'flag' => 'fr'],
    ])
    ->languageSwitcher(true)
    ->languageSwitcherRenderHook('panels::user-menu.before')
    ->navigationGroup('Settings')
    ->navigationIcon('heroicon-o-globe-alt')
    ->showFlags(true)
    ->disableKeyAndGroupEditing(false)
    ->dontRegisterNavigationOnPanelIds(['guest'])
    ->prependDirectoryPathToGroupName(false)

Available Configuration Methods

  • availableLocales(array $locales) - Set available application locales
  • disableKeyAndGroupEditing(bool $disable = true) - Control key/group editing
  • languageSwitcher(bool $enable = true) - Enable/disable language switcher
  • languageSwitcherRenderHook(string $hook) - Set render hook for language switcher
  • navigationGroupTranslationKey(?string $key) - Set navigation group translation key
  • navigationGroup(?string $group) - Set navigation group
  • navigationIcon(mixed $icon) - Set navigation icon (supports false to disable)
  • dontRegisterNavigationOnPanelIds(array $panelIds) - Exclude panels from navigation
  • showFlags(bool $show = true) - Show flags in language switcher
  • prependDirectoryPathToGroupName(bool $prepend = true) - Control group naming

Config File

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

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

Authorization

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

// app/Providers/AppServiceProvider.php

use Illuminate\Support\Facades\Gate;

/**
 * Bootstrap any application services.
 */
public function boot(): void
{
    Gate::define('use-translation-manager', function (?User $user) {

        return $user !== null && $user->hasRole('admin');
    });
}

available_locales

Determines which locales your application supports. For example:

'available_locales' => [
    ['code' => 'en', 'name' => 'English', 'flag' => 'gb'],
    ['code' => 'ar', 'name' => 'Arabic', 'flag' => 'sa'],
]

language_switcher

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

License

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