Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Moeez448's avatar

want to convert api input fields validation to arabic.

I want to covert the validation messages to arabic in laravel api . Here is my code. $validator = Validator::make($request->all(), [ 'phone' => 'required|min:8|max:15|regex:/^[+?\d\s]*$/', 'code' => 'required', ]); if ($validator->fails()) { return $this->responseApi($validator->messages()->all(), false, 'Validation Errors', 400); }

Please suggest a solution to this problem.

0 likes
3 replies
Sinnbeck's avatar

Please format your code by adding ``` on the line before it. You can edit the post

Moeez448's avatar

@Sinnbeck I have a simple validation for an Api in Laravel I just want to return the validation error messages in Arabic.

Sinnbeck's avatar

@Moeez448 So translate them and the the locale to arabic? Just add a new folder in your lang directory called ar and add the php files, and translate them (examples are in /lang/en)

Please or to participate in this conversation.