Translate other languages.
I need to translate "Navigation" and other pages into the language I'm using. From what I've seen in other tutorials, I only know how to activate language packs for specific countries. What I'm curious about is how to translate other pages and the navigation itself. I've tried adding files, but it hasn't been successful.
16 Replies
For navigation you can do like this https://filamentphp.com/docs/3.x/panels/navigation#customizing-a-navigation-items-label
For more details read laravel localization here https://laravel.com/docs/10.x/localization#main-content
I successfully switched the language for navigation. However, I'm not quite sure how to translate the titles and the text inside the tables (not the data) on those pages. I went through the Laravel documentation you provided and tried to follow it, but it doesn't seem to work. Or maybe I misunderstood something
For table/form label, you can use like this https://filamentphp.com/docs/3.x/tables/columns/getting-started#setting-a-label
This code is very helpful
->label(__('message.abc'))
for translation part, even you can change button label alsoi sucess the table part and button
is there a way to change the titles? This is the last section
wdym? what titles?
There's a away to translate everything. Check the docs and methods using your ide
You probably want to translate
getModelLabel()
, getModelPluralLabel()
, getNavigationLabel()
etc.This method works for Resources, but it is not effective for Custom pages
They have their own properties and methods. Title and or Heading?
I don't know if this belongs to Title or Heading.
Try both
"In vendor\filament\filament\src\Resources\Pages\Page.php, I didn't see
protected static ?string $modelLabel = null;
like what's in vendor\filament\filament\src\Resources\Resource.php,
so using
protected static ?string $modelLabel
in app\Filament\Resources\AttendanceResource\Pages\Attend.php doesn't
have any effect.
Should I define it in vendor\filament\filament\src\Resources\Pages\Page.php?"
never edit vendor files
If it's not there it doesn't exist. You are probably still looking for
$title
or $heading