lundi 11 septembre 2017

Laravel translate json HTTP response message

I have multilingual application using . I need to translate the ajax response of the HTTP header. I have the following message in the Arabic section:

عفوا ولكن هناك الخطأ التالي:422 Unprocessable Entity مع رسالة خاصة تقول:

This an Arabic content and I want to translate the words "Unprocessable Entity 422" too.

I tried to modify the $headers array parameter of the json method like the following:

return response()->json([__('The status selected is not Equipment related status')], 422,['Status Code' => __('Any translable message')], JSON_UNESCAPED_UNICODE);

However, setting the headers parameter like ['Status Code' => __('Any translable message')] generates internal server error.

How could I translate that HTTP response correctly?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire