Skip to main content
Quick Tip

Filament Multi-language: Translate Navigation Menu Label

If you work with multi-language projects and want the navigation menu items to be translatable, you can't use the __() function in the PHP class property:

class ProductResource extends Resource
{
// You can't do that:
protected static ?string $navigationLabel = __('Products');

That code will lead to an error:

Instead, you can define this label in a method getNavigationLabel():

class ProductResource extends Resource
{
public static function getNavigationLabel(): string
{
return __('Products');
}

Then the translations will work without any errors.

Enjoyed This Tip?

Get access to all premium tutorials, video and text courses, and exclusive Laravel resources. Join our community of 10,000+ developers.

Recent Courses

Laravel Modules and DDD

16 lessons
1 h 59 min

Filament 4 From Scratch

28 lessons
2 h 25 min

Laravel HTTP Client and 3rd-Party APIs

7 lessons
50 min

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.