我试图在 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> ');
}}
'''
即使我将它 locale="ar" 放在 app.php 中,它也总是以英文打印
我希望你能帮我解决这个问题..如果你需要任何额外的信息告诉我..谢谢你的时间