F
Filament12mo ago
Wirkhof

How to set a language for Filament?

I want to have French for normal Laravel frontend and then English for admin which is in Filament. In app.php I have set locale to French but French is then also in Filament. How to set up English for Filament admin? Because right now everything is in French, including Filament admin.
Solution:
I would probably make a middleware that checks if it's a filament route then do app()->setLocale('en') to force it.
Jump to solution
2 Replies
Solution
awcodes
awcodes12mo ago
I would probably make a middleware that checks if it's a filament route then do app()->setLocale('en') to force it.
Wirkhof
WirkhofOP12mo ago
Interesting. Thanks. I ended up with https://filamentphp.com/plugins/bezhansalleh-language-switch for now. It seems to remember my choice and is not too distractive in the top bar - could be even useful to be able to effortlessly switch languages even in admin in certain situation in the future. But your solution and checking /admin/* etc. and forcing setLocale('en') is probably the way to go.
Want results from more Discord servers?
Add your server