How to use Spatie Translatable in filament custom page?

I have a page that is not a resource because there will be one record. But I don't know how to make LocalSwitcher work. I have tried everything possible that came to my mind.
class PrivacyPolicy extends Page implements HasForms, HasActions
{
use InteractsWithForms;
use InteractsWithActions;

protected static ?string $navigationIcon = 'heroicon-o-document-text';

protected static string $view = 'filament.pages.privacy-policy';

public ?array $data = [];

public ?PrivacyPolicyModel $record = null;

public function mount(): void
{
//...
}

protected function getHeaderActions(): array
{
return [
LocaleSwitcher::make(),
];
}

public static function getTranslatableLocales(): array
{
return getSupportedLanguagesKeys();
}

public function form(Form $form): Form
{
return $form->schema([
//...
]);
}
}
class PrivacyPolicy extends Page implements HasForms, HasActions
{
use InteractsWithForms;
use InteractsWithActions;

protected static ?string $navigationIcon = 'heroicon-o-document-text';

protected static string $view = 'filament.pages.privacy-policy';

public ?array $data = [];

public ?PrivacyPolicyModel $record = null;

public function mount(): void
{
//...
}

protected function getHeaderActions(): array
{
return [
LocaleSwitcher::make(),
];
}

public static function getTranslatableLocales(): array
{
return getSupportedLanguagesKeys();
}

public function form(Form $form): Form
{
return $form->schema([
//...
]);
}
}
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server