Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Filament Language Switch

Filament Language Switch Laravel Package

bezhansalleh/filament-language-switch

View on GitHub
Deep Wiki
Context7

Zero config Language Switch(Changer/Localizer) plugin for filamentphp admin

Frequently asked questions about Filament Language Switch
How do I install this package in a Laravel project with Filament 5.x?
Run `composer require bezhansalleh/filament-language-switch`, then ensure your Filament panel has a custom theme. Add `@source '../../../../vendor/bezhansalleh/filament-language-switch/**';` to your `theme.css` and rebuild with `npm run build`. No additional Laravel config is needed if locales are already defined in `app.php`.
Does this work with Filament 4.x or earlier versions?
No, this package **only supports Filament 5.x**. Filament 4.x is no longer supported, so upgrading to Filament 5.x is required. Check the [Filament 5.x migration guide](https://filamentphp.com/docs/5.x/upgrading) for compatibility steps.
Can I customize the language switcher’s UI placement (e.g., footer, custom widget)?
Yes, use the `languageSwitchOptions` hook in your panel provider to override default placements (topbar, sidebar, or user menu). For non-standard locations, embed the component manually via Blade or widgets. Example: `$this->languageSwitchOptions(['placement' => 'footer']);`
How does language switching work—URL-based or session-based?
By default, it uses **session-based** switching (persists across tabs). For URL-based switching (e.g., `/en/dashboard`), combine this with Laravel’s `Localization` middleware or the `spatie/laravel-localization` package. The plugin itself doesn’t handle frontend routes.
Will this break if I update Filament to a future major version (e.g., 6.x)?
There’s a **high risk of breaking changes** if Filament 6.x alters its Blade component structure or widget system. Pin Filament to `5.x` in `composer.json` to avoid unintended upgrades. Monitor Filament’s release notes for view/template changes affecting UI placement.
Can I use custom flags or locale labels instead of the default ones?
Yes, override flags or labels via the `languageSwitchOptions` hook. For example: `$this->languageSwitchOptions(['flags' => ['en' => '🇬🇧', 'fr' => '🇫🇷'], 'labels' => ['en' => 'English', 'fr' => 'Français']]);`
Does this support right-to-left (RTL) languages like Arabic or Hebrew?
Yes, the plugin respects RTL languages out of the box. Test RTL locales in your Filament 5.x panel to ensure UI alignment (e.g., sidebar placement). If issues arise, check your custom theme’s CSS for RTL overrides.
How do I exclude specific Filament panels from showing the language switcher?
Use the `excludePanels` option in `languageSwitchOptions`. Example: `$this->languageSwitchOptions(['excludePanels' => ['settings']]);` This hides the switcher from the specified panels while keeping it active elsewhere.
Is there a way to dynamically fetch locales from a database or API?
Not natively, but you can extend the plugin using the `languageSwitchOptions` hook. For dynamic locales, bind a custom resolver to Filament’s locale service or override the `getSupportedLocales()` method in a service provider.
What’s the best way to test this package in a CI/CD pipeline?
Test UI placement (topbar/sidebar/user menu) across Filament 5.x themes. Use Laravel’s `actingAs()` to simulate user sessions and verify locale persistence. For RTL languages, add a test case with Arabic/Hebrew locales and validate alignment. Mock Filament’s widget system if needed.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
besmartand-pro/php-quality-config
sentix/ai-chatbot
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity