F
Filamentβ€’5mo ago
Aminne

How i can translate the validation error message

I use filament language switcher plugin.
No description
Solution:
You can check a package like Laravel Lang: https://github.com/Laravel-Lang/lang...
GitHub
GitHub - Laravel-Lang/lang: List of 126 languages for Laravel Frame...
List of 126 languages for Laravel Framework, Laravel Jetstream, Laravel Fortify, Laravel Breeze, Laravel Cashier, Laravel Nova, Laravel Spark and Laravel UI. - Laravel-Lang/lang
Jump to solution
11 Replies
Dennis Koch
Dennis Kochβ€’5mo ago
Those should be default Laravel validation messages
Solution
Dennis Koch
Dennis Kochβ€’5mo ago
You can check a package like Laravel Lang: https://github.com/Laravel-Lang/lang
GitHub
GitHub - Laravel-Lang/lang: List of 126 languages for Laravel Frame...
List of 126 languages for Laravel Framework, Laravel Jetstream, Laravel Fortify, Laravel Breeze, Laravel Cashier, Laravel Nova, Laravel Spark and Laravel UI. - Laravel-Lang/lang
Aminne
AminneOPβ€’5mo ago
Thank you so much i will check it. I use the plugin filament switcher it's useful for this case ?
Dennis Koch
Dennis Kochβ€’5mo ago
Filament switcher just switched the locale. You still need the translations
Aminne
AminneOPβ€’5mo ago
okay i understand now, thank you. It works with this library, thank you this help so much .
Dennis Koch
Dennis Kochβ€’5mo ago
You're welcome
Aminne
AminneOPβ€’5mo ago
I have a quickly question how i use eager loading for avoid N+1 problem this's my code
public function index(ListPostRequest $request)
{
$validated = $request->validated();
$posts = Post::with(['comments.user', 'categories', 'user'])
->where('status', 'published')->get();
return PostResource::collection($posts);
public function index(ListPostRequest $request)
{
$validated = $request->validated();
$posts = Post::with(['comments.user', 'categories', 'user'])
->where('status', 'published')->get();
return PostResource::collection($posts);
public function toArray(Request $request): array
{ 'categories'=> $this->categories,
'author' => [
'id' => $this->user->id,
'name' => $this->user->name,
'email' => $this->user->email
] }
public function toArray(Request $request): array
{ 'categories'=> $this->categories,
'author' => [
'id' => $this->user->id,
'name' => $this->user->name,
'email' => $this->user->email
] }
My eager loading is correct ?
Dennis Koch
Dennis Kochβ€’5mo ago
Not sure why you need comments.user but apart from that it looks good.
Aminne
AminneOPβ€’5mo ago
I'm didn't provide all the code. Thank you for your help.
problemli
problemliβ€’2mo ago
Hey @Aminne How did you install the lang package? My normal translations work, but i want to use their premade messages for validation rules, and they are not used. Did you copy any files? Would be very grateful for any pointers... πŸ™‚
Dennis Koch
Dennis Kochβ€’2mo ago
Want results from more Discord servers?
Add your server