Locale Switcher
CommunityDrop a flag dropdown in your Filament topbar so every admin picks their own UI language — session, user-column or cookie persistence, six-step resolution, one line of config.
Author:
Pruna Catalin
Package health
BetaAutomated checks of this plugin's Composer package
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 86 days ago; last release 86 days ago.
-
Passed:
composer.lock not committed by library
—
composer.lockis absent from the released dist archive. - Passed: Dist archive is lean
-
Warning:
Current Laravel version supported
—
Package support for current Laravel
13.0could not be verified; the newest co-installable line is12.0, which receives security patches only (until 2027-02-24). Line13.0could not be fully verified: no solution was found among the newest package versions, and resolving the complete version pool exceeded solver resource budgets, so support there cannot be ruled out. -
Passed:
Current PHP version supported
—
Constraint
^8.2supports current PHP8.5. - Skipped: Current Symfony version supported
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
.
Documentation
Drop-in locale switcher for Filament v4/v5 panels. Topbar dropdown (or user-menu items), session / per-user / cookie persistence, explicit locale whitelist, six-step resolution chain.
#Install
composer require prunacatalin/filament-locale-switcher
Publish the config (optional — the plugin works without it, but config is the recommended source of truth):
php artisan vendor:publish --tag=filament-locale-switcher-config
If you intend to persist the user's choice on their account, run the migration to add a locale column to users:
php artisan migrate
#Configure
config/filament-locale-switcher.php:
return [
'locales' => ['en', 'ro', 'fr', 'it'],
'labels' => [
'en' => 'English',
'ro' => 'Română',
'fr' => 'Français',
'it' => 'Italiano',
],
'flags' => [
'en' => '🇬🇧',
'ro' => '🇷🇴',
'fr' => '🇫🇷',
'it' => '🇮🇹',
],
'persist' => 'user', // session | user | cookie
'user_column' => 'locale', // column on User when persist=user
'placement' => 'topbar', // topbar | user-menu | both
'topbar_offset' => '4.5rem', // CSS gap between switcher and user-menu
];
#Wire it into your panel
Two lines: register the plugin, append the middleware to your panel middleware list (it MUST run after StartSession).
use Prunacatalin\FilamentLocaleSwitcher\Http\Middleware\ApplyLocale;
use Prunacatalin\FilamentLocaleSwitcher\LocaleSwitchPlugin;
public function panel(Panel $panel): Panel
{
return $panel
// …your usual config…
->plugin(LocaleSwitchPlugin::make())
->middleware([
// …default Filament middleware (EncryptCookies, StartSession, …)…
ApplyLocale::class,
]);
}
That's it. The plugin reads from config/filament-locale-switcher.php; the dropdown renders in the panel topbar; clicking a flag persists the choice and reloads the current page in that language.
#Per-panel override
Every config key has a matching fluent setter. Useful when a single Laravel app hosts two panels with different policies:
$panel->plugin(
LocaleSwitchPlugin::make()
->locales(['en', 'de']) // narrower than the global list
->persist('cookie') // override global persist
->placement('user-menu'), // override global placement
);
Setters always win over config.
#Resolution chain (per request)
?lang=xxquery parameter- session value (last switch in this browser)
- cookie (when
persist=cookie) - authenticated user's column (when
persist=user) Accept-Languageheaderconfig('app.locale')
Anything outside the configured locales whitelist is rejected — tampered session/cookie values can never load an arbitrary lang path.
#Testing
composer install
composer test
Pest suite uses Orchestra Testbench with SQLite :memory:. 21 tests / 39 assertions cover the resolver chain, the plugin's config hydration, the middleware, and every controller persistence branch.
#License
MIT.
The author
Laravel & Filament developer at Webdirect, focused on admin panels and line-of-business applications. Most of my day is spent turning messy operational workflows into clean Filament resources, tables, and forms.
I publish open-source plugins whenever an idea shows up more than twice across my own projects. The goal is always the same: make the common case easy, keep the API predictable, and write enough tests that future-me doesn't get burned.
From the same author
Featured Plugins
A selection of plugins curated by the Filament team
Custom Dashboards
Let your users build and share their own dashboards with a drag-and-drop interface. Define your data sources in PHP and let them do the rest.
Filament
Spotlight Pro
Browse your Filament Panel with ease. Filament Spotlight Pro adds a Spotlight like Command Palette to your Filament Panel.
Dennis Koch
Custom Fields
Eliminate custom field migrations forever. Let your users create and manage form fields directly in Filament admin panels with 20+ built-in field types, validation, and zero database changes.
Relaticle