New Features
-
Dynamic locales via Closure — load languages from a database or any dynamic source:
->locales(fn () => Language::pluck('code')->toArray()) -
Simplified locale syntax — pass plain language codes instead of arrays:
->locales(['en', 'fr', 'de']) -
Show on auth pages — display the language switcher on login, register, and password reset pages with a single method:
->showOnAuthPages() -
Cookie persistence — remember the selected locale across browser sessions:
->rememberLocale() -
LocaleChanged event (PHP) — react to locale changes on the backend with both new and previous locale:
Event::listen(LocaleChanged::class, function (LocaleChanged $event) {}); -
Browser event (JavaScript) — filament-locale-changed event dispatched after locale switch:
window.addEventListener('filament-locale-changed', (e) => {});
Improvements
- Locale validation — invalid locale codes (e.g. 'en, pl' instead of 'en', 'pl') now throw a clear error message
- Graceful SVG fallback — if a flag icon is not found, a fallback icon is shown instead of crashing