F
Filament5mo ago
kossa

Spatie translatable: Switcher not showing in simple resource

Hello, I'm using https://filamentphp.com/plugins/filament-spatie-translatable, it works fine on all pages, except for simple resource, in the doc they mentioned "If you're using a simple resource, you can make the ManageRecords page translatable instead:" here is my code
<?php

namespace App\Filament\Resources\MainRouteResource\Pages;

use App\Filament\Resources\MainRouteResource;
use Filament\Actions;
use Filament\Actions\LocaleSwitcher;
use Filament\Resources\Pages\ListRecords;
use Filament\Resources\Pages\ManageRecords;

class ListMainRoutes extends ListRecords
{
use ManageRecords\Concerns\Translatable;

protected static string $resource = MainRouteResource::class;

protected function getHeaderActions(): array
{
return [
LocaleSwitcher::make(),
Actions\CreateAction::make(),
];
}
}
<?php

namespace App\Filament\Resources\MainRouteResource\Pages;

use App\Filament\Resources\MainRouteResource;
use Filament\Actions;
use Filament\Actions\LocaleSwitcher;
use Filament\Resources\Pages\ListRecords;
use Filament\Resources\Pages\ManageRecords;

class ListMainRoutes extends ListRecords
{
use ManageRecords\Concerns\Translatable;

protected static string $resource = MainRouteResource::class;

protected function getHeaderActions(): array
{
return [
LocaleSwitcher::make(),
Actions\CreateAction::make(),
];
}
}
No description
1 Reply
Dennis Koch
Dennis Koch5mo ago
Simple resources don't have header actions. That sentence probably means, that you can select the language on the List Page and the slide out will respect the current selected langauge.

Did you find this page helpful?