iam trying to make multilanguage view in laravel i set up everything but when i change the localization in config/app.php from "en" to "ar" ... it stays "en" and i tested with the function App::getLocal
my files of translation "messages.php" for "en"
'''
<?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"
];
''' for "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" => "يجب ادخال رابط الصورة"
];
''' when i print a message for test using this code : '''
<?php
namespace App\Http\Controllers;
use App;
use Illuminate\Http\Request;
class locale extends Controller
{
function getlocal(){
echo __('messages.offer name required');
echo(' <br> ');
}}
'''
it always prints in english eventhough iam putting it locale="ar" in app.php
i hope you can help me solve this .. and if you need any additional infos tell me .. thank you for your time
You can try clear cache with
php artisan config:clear
command.Probably a problem with a spaces. Try to change