Mcamara\LaravelLocalization\Exceptions\SupportedLocalesNotDefined error given after install

1.8k Views Asked by At

I just install 'mcamara/laravel-localization' after install follow to steps and add

Route::group(
[
    'prefix' => LaravelLocalization::setLocale(),
    'middleware' => [ 'localeSessionRedirect', 'localizationRedirect', 'localeViewPath' ]
], function(){ //...
});

to my route. After that, I encounter

Mcamara\LaravelLocalization\Exceptions\SupportedLocalesNotDefined
Supported locales must be defined.

I guess it is not read to the config file for Supported locales array. So don't know how to fix it. I am using laravel 7.19.1. I need help.

2

There are 2 best solutions below

0
On
php artisan config:cache

is fixed all.

0
On

look.. if you have this line in Web.php file

Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => ['localeSessionRedirect', 'localizationRedirect', 'localeViewPath']], function ()

1- make it's as comment and run in terminal : php artisan config:clear. php artisan config:cache.

2- then delete comment from line.