How to read the lang file/translation when registering navigationItems in a panel?

E.g this displays the 'filament-panels::layout.actions.billing.label' instead of the translated label.
public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->navigationItems([
            NavigationItem::make('billing')
                ->label(__('filament-panels::layout.actions.billing.label'))
        ]);
}

Another issue when registering a custom navigation you've unable to use the resource getUrl method. This used to work in v2 but getting an error that the panel has not been setup yet.
Call to a member function getId() on null
public static function getRouteBaseName(?string $panel = null): string
    {
        $panel ??= Filament::getCurrentPanel()->getId();

NavigationItem::make('product-redirects')
    ->url(ProductResource::getUrl('redirects'))
    ->isActiveWhen(fn () => request()->routeIs(ProductResource::getRouteBaseName() . '.redirects'))

Redirects is a custom list resource page which needs registering manually
public static function getPages(): array
{
    return [
        'index' => Pages\ListProductRedirect::route('/'),
        'redirects' => Pages\ListProductRedirect::route('/redirects'),
    ];
}


Tried to manually use route() helper function instead of the getting the resources but that does not work either.
Route [filament.admin.resources.products.index] not defined.
->navigationItems([
    NavigationItem::make()
        ->label('Settings')
        ->url(route('filament.admin.resources.products.index'))
        ->icon('heroicon-o-cog-6-tooth'),
])

Confirmed the route name is correct and visible when I run php artisan route:list.
Adding debug code to test the routes collection is empty at the point of registering the panel configuration dd(Route::getRoutes());
Solution
Got it working in the end cheers for the help guys!
I found that I needed to update all calls to the label/group language calls otherwise it broke them all. Took a lot of trial and error with loads of coffee
Was this page helpful?