0

laravelで多言語ビューを作成しようとしていますが、すべてを設定しましたが、config/app.phpのローカリゼーションを「en」から「ar」に変更すると...「en」のままで、関数App::getLocalでテストしました

「en」の翻訳「messages.php」の私のファイル

'''

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Authentication Language Lines
    |--------------------------------------------------------------------------
    |
    | The following language lines are used during authentication for various
    | messages that we need to display to the user. You are free to modify
    | these language lines according to your application's requirements.
    |
    */
"offer name required" => "the name field is required",
"offer name max" => "the name cannot exceed 100 characters",
"offer name unique" => "offer name is already used",
"offer photo required" => "photo field is required also"
];

「ar」の「」

'''

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Authentication Language Lines
    |--------------------------------------------------------------------------
    |
    | The following language lines are used during authentication for various
    | messages that we need to display to the user. You are free to modify
    | these language lines according to your application's requirements.
    |
    */
"offer name required" => "يجب ادخال اسم العرض",
"offer name max" => "يجب أن لا يتعدى الاسم 100 عنصرا",
"offer name unique" => "هذا الاسم غير متوفر",
"offer photo required" => "يجب ادخال رابط الصورة"
];

''' このコードを使用してテスト用のメッセージを出力すると: '''

<?php

namespace App\Http\Controllers;
use App;
use Illuminate\Http\Request;

class locale extends Controller
{
    function getlocal(){
 
     echo __('messages.offer name required');
     echo(' <br> ');
   
}}

'''

app.php に locale="ar" を入れていますが、常に英語で出力されます

これを解決するのを手伝ってくれることを願っています..追加情報が必要な場合は教えてください..お時間をいただきありがとうございます

4

2 に答える 2