F
Filamentβ€’2y ago
Prodex

Translate Resource Title

Is there a way to just translate the resource title without having to specify all titles for all pages?
10 Replies
Dennis Koch
Dennis Kochβ€’2y ago
Not really. You could extend all base pages and overwrite getTitle() on them and then extend your pages instead.
Prodex
ProdexOPβ€’2y ago
hm okay, would be cool because I'm currently in the situation where I need to translate just the resource title. Filament already supports german but if my models are written in english it would be super nice to have just one configuration for the label and all views and delete modals would take it.
Dennis Koch
Dennis Kochβ€’2y ago
I think we had this in v1 and it was causing issues
Prodex
ProdexOPβ€’2y ago
can you quickly tell me where or how I can set the deletion modal text?
Dennis Koch
Dennis Kochβ€’2y ago
DeleteAction::make()->modalHeading()
Prodex
ProdexOPβ€’2y ago
Ah, thanks πŸ™
Dennis Koch
Dennis Kochβ€’2y ago
Maybe I got you wrong. What do you mean by "having to specify all titles for all pages"? If you set the $modelLabel and $modelPluralLabel it should use that one for all pages.
Prodex
ProdexOPβ€’2y ago
Ah, just found it in the docs. Yeah, totally meant that one, sorry for my bad wording.
Falk Maria Zeitsprung
Hi, how can i make the $modelLabel translatable? This does NOT work:
protected static ?string $modelLabel = __('Post);
protected static ?string $modelLabel = __('Post);
Found it in Documentation, sorry: '''public static function getModelLabel(): string { return __('filament/resources/customer.label'); }''''
Prodex
ProdexOPβ€’2y ago
No worries, I fell into the same trap some days ago πŸ˜‰
Want results from more Discord servers?
Add your server