Language Switcher plugin screenshot
Dark mode ready
Multilingual support
Supports v5.x

Language Switcher

Community

Zero-config language switcher for Filament admin panels with automatic translation detection and country flags.

Tags: Panels
Supported versions:
5.x 4.x 3.x
Craft Forge avatar Author: Craft Forge

Package health

Beta

Automated checks of this plugin's Composer package

92 / 100
Security 85
Maintenance 100
Ecosystem 100
15 checks
  • Skipped: GitHub Actions pinned to SHA
  • Skipped: GitLab CI includes pinned to SHA
  • Passed: Open security advisories
  • Passed: Dependabot PR responsiveness — No open Dependabot PRs.
  • Skipped: Renovate MR responsiveness
  • Skipped: Dependabot or Renovate configured
  • Skipped: Dependency update cooldown configured
  • Failed: Provides a security policy View details on Plumb
  • Passed: Abandoned or archived — No consulted source marks the package abandoned (packagist, github).
  • Passed: Commit and release recency — Active: last commit 143 days ago; last release 144 days ago.
  • Passed: composer.lock not committed by library composer.lock is absent from the released dist archive.
  • Passed: Dist archive is lean
  • Passed: Current Laravel version supported — Package dependencies resolve together with current Laravel 13.0.
  • Passed: Current PHP version supported — Constraint ^8.1 supports current PHP 8.5.
  • Skipped: Current Symfony version supported
Third-party plugin. This is built by the community, not the Filament team. Filament does not review, endorse, or vet the security of plugins outside the filament/ namespace. Review the source and install at your own risk. Found malware or an unresolved security issue the author won't address? Report it .
Powered by Plumb Last scanned 2 days ago

Documentation

A simple and elegant language switcher plugin for Filament admin panels. Automatically detects available Filament translations or allows custom language configuration with optional flag icons. Supports auth pages, cookie persistence, and locale change events.

Language Switcher Demo

Language Switcher In Dark Mode

#Demo

→ Live Demo

#Installation

Plugin Version Filament Version PHP Version
1.x 3.x, 4.x, 5.x > 8.1

1. Install the package via Composer:

composer require craft-forge/filament-language-switcher

2. Register the plugin in your Filament panel configuration (e.g. AdminPanelProvider):

use CraftForge\FilamentLanguageSwitcher\FilamentLanguageSwitcherPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            FilamentLanguageSwitcherPlugin::make(),
        ]);
}

The plugin will automatically detect available Filament language files and display them in a dropdown menu.

#Configuration

#Locales

By default, the plugin auto-detects available Filament language files. To define the locale list manually, pass it to locales() - choose one of three formats:

Locale codes - names and flags are resolved automatically from the built-in dictionary (200+ languages):

FilamentLanguageSwitcherPlugin::make()
    ->locales(['en', 'fr', 'de'])

Full control - specify name and flag per locale. Flag codes reference: https://flagicons.lipis.dev.

FilamentLanguageSwitcherPlugin::make()
    ->locales([
        ['code' => 'en', 'name' => 'English', 'flag' => 'us'],
        ['code' => 'fr', 'name' => 'Français', 'flag' => 'fr'],
        ['code' => 'de', 'name' => 'Deutsch', 'flag' => 'de'],
    ])

Dynamic - load locales at runtime (e.g. from a database):

FilamentLanguageSwitcherPlugin::make()
    ->locales(fn () => Language::pluck('code')->toArray())

Language Switcher Locales

#Remember Locale

Store the selected locale in a cookie to persist across browser sessions (e.g. after logout):

FilamentLanguageSwitcherPlugin::make()
    ->rememberLocale()          // forever
    ->rememberLocale(days: 30)  // for 30 days

#Custom Render Hook

Change where the language switcher appears in the panel:

use Filament\View\PanelsRenderHook;

FilamentLanguageSwitcherPlugin::make()
    ->renderHook(PanelsRenderHook::USER_MENU_PROFILE_AFTER)

Popular placements:

  • USER_MENU_BEFORE — before the user menu (default)
  • USER_MENU_PROFILE_AFTER — after user profile in dropdown
  • USER_MENU_AFTER — after the user menu
  • SIDEBAR_FOOTER — at the bottom of sidebar
  • FOOTER — in the page footer

All available render hooks: https://filamentphp.com/docs/5.x/advanced/render-hooks

Language Switcher Render Hook

#Show on Auth Pages

Display the language switcher on login, register, and password reset pages:

FilamentLanguageSwitcherPlugin::make()
    ->showOnAuthPages()

#Hide Flags

Display only language names without flag icons:

FilamentLanguageSwitcherPlugin::make()
    ->showFlags(false)

#Event

The plugin dispatches a LocaleChanged event whenever a user switches locale, providing both the new and previous locale:

use CraftForge\FilamentLanguageSwitcher\Events\LocaleChanged;
use Illuminate\Support\Facades\Event;

public function boot(): void
{
    Event::listen(LocaleChanged::class, function (LocaleChanged $event) {
        // auth()->user()->setLocale($event->newLocale);
        // Log::info("Locale changed from {$event->oldLocale} to {$event->newLocale}");
    });
}

#License

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

The author

Craft Forge avatar Author: Craft Forge

Creating production-ready Filament plugins with a focus on simplicity, clean UX, and zero-configuration.

Plugins
2
Stars
37

From the same author