Shroomteller
Shroomteller
FFilament
Created by Shroomteller on 3/2/2024 in #❓┊help
Filament Language Switch not visible outside panels
Hello, I'm successfully using this language switcher in panels, but in the frontend -- outside of panels -- it's not displaying unless I manually add the component, like so: <livewire:filament-language-switch key='fls-outside-panels' /> This causes the language switcher to show up in the bottom-right corner of the page, and it still works, but I want it to continue showing up in the Filament user menu, which I'm also rendering on my frontend outside of panels. Here is how I've configured the plugin in the boot() method of AppServiceProvider.php:
LanguageSwitch::configureUsing(function (LanguageSwitch $switch) {
$switch
->locales(['en','es'])
->renderHook(PanelsRenderHook::USER_MENU_PROFILE_AFTER)
->labels([
'en' => 'English (EN)',
'es' => 'Castellano (ES)',
])
->visible(outsidePanels: true)
->outsidePanelRoutes([
'home',
])
->outsidePanelPlacement(Placement::BottomRight);
});
LanguageSwitch::configureUsing(function (LanguageSwitch $switch) {
$switch
->locales(['en','es'])
->renderHook(PanelsRenderHook::USER_MENU_PROFILE_AFTER)
->labels([
'en' => 'English (EN)',
'es' => 'Castellano (ES)',
])
->visible(outsidePanels: true)
->outsidePanelRoutes([
'home',
])
->outsidePanelPlacement(Placement::BottomRight);
});
I'm including the FIlament user menu like so in my frontend layout: <x-filament-panels::user-menu />. I've gotten other things working outside of panels, like dropdown menus and the light/dark mode switcher, but this language switcher eludes me.
3 replies
FFilament
Created by Shroomteller on 2/23/2024 in #❓┊help
Translatable plugin locale switcher not working
I have installed the Spatie Translatable plugin v3.2, followed the instructions in the Filament and Spatie documentation, and set up my resource to translate columns on a relationship called "meta." I'm also using Spatie's Sluggable package and have set slugs up for translation per the documentation. Before using the translation plugin, slugs were working fine. I have two problems at the moment: 1. The locale switcher defaults to English, whereas my current app locale is actually Spanish. How do I get the locale switcher to sync with what my current locale is? 2. When I switch locales, the translatable fields all go blank. Looking in the database, the data is there, exactly like the English data (added via a Seeder). E.g. for my title column: {"en": "Course", "es": "Curso"}. Here is the relevant area in the form:
Section::make('Details')
->relationship('meta')
->schema([
TextInput::make('title')
]);
Section::make('Details')
->relationship('meta')
->schema([
TextInput::make('title')
]);
7 replies