Keep the selected language from "Spatie Translatable Plugin"
Hey guys, this is my first post and officially my first time with Filament.
So, basically what I'm trying to achieve is keep the lang that I've just selected for the whole app. If I want to create a new record in Portuguese I want this value keep intact when listing and editing.
If you need more info I'll be happy to share.
Thanks
7 Replies
the plugin always select the first language
you can set "Portuguese" the first one in the panel provider
That doesn't resolve my issue. Thanks anyway.
I don’t think your going to be able to do this with the locale switcher action. What it does is change the underlying local to edit the form fields in the different locales. If it set the app locale on change then the entire app would change meaning all your labels, etc would switch to that locale.
Tbh I dont have any problem that it changes the lang for the entire app. But thank for the heads up.
you're users might. 🙂
Nop, they dont. 😉
If you're providing a language-chooser for the entire app, shouldn't you be firing something like
App::setLocale($locale)
in Laravel after the user makes a selection? Like maybe in ->action()
connected to the select field?
https://laravel.com/docs/master/localization#configuring-the-locale
https://filamentphp.com/docs/3.x/actions/modals
And maybe persist something in their session to remember their choice?Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.