Mcamara Package Error hi after install Mcamara Package i got this Error
Mcamara\LaravelLocalization\Exceptions\SupportedLocalesNotDefined
Supported locales must be defined.
any solution to solve this problem
Run
php artisan vendor:publish --provider="Mcamara\LaravelLocalization\LaravelLocalizationServiceProvider"
and then
php artisan config:clear
// or
php artisan config:cache
Hi @ethar
php artisan vendor:publish --provider="Mcamara\LaravelLocalization\LaravelLocalizationServiceProvider"
its in the docs, you probably need to define your locales in config file first:
The configuration options are:
- supportedLocales Languages of your app (Default: English & Spanish).
- useAcceptLanguageHeader If true, then automatically detect language from browser.
- hideDefaultLocaleInURL If true, then do not show default locale in url.
- localesOrder Sort languages in custom order.
- localesMapping Rename url locales.
- utf8suffix Allow changing utf8suffix for CentOS etc.
- urlsIgnored Ignore specific urls.
So I guess you locale is neither english or spanish?
Hope it helps!
when i perform any of above commands I got
Mcamara\LaravelLocalization\Exceptions\SupportedLocalesNotDefined
Supported locales must be defined.
at C:\xampp\htdocs\site\panorama\vendor\mcamara\laravel-localization\src\Mcamara\LaravelLocalization\LaravelLocalization.php:470
466|
467| $locales = $this->configRepository->get('laravellocalization.supportedLocales');
468|
469| if (empty($locales) || !\is_array($locales)) {
470| throw new SupportedLocalesNotDefined();
471| }
472|
473| $this->supportedLocales = $locales;
474|
1 C:\xampp\htdocs\site\panorama\vendor\mcamara\laravel-localization\src\Mcamara\LaravelLocalization\LaravelLocalization.php:141
Mcamara\LaravelLocalization\LaravelLocalization::getSupportedLocales()
2 C:\xampp\htdocs\site\panorama\vendor\mcamara\laravel-localization\src\Mcamara\LaravelLocalization\LaravelLocalizationServiceProvider.php:55
Mcamara\LaravelLocalization\LaravelLocalization::__construct()
when i perform any of above commands I got
Mcamara\LaravelLocalization\Exceptions\SupportedLocalesNotDefined
Supported locales must be defined.
at C:\xampp\htdocs\site\panorama\vendor\mcamara\laravel-localization\src\Mcamara\LaravelLocalization\LaravelLocalization.php:470 466| 467| $locales = $this->configRepository->get('laravellocalization.supportedLocales'); 468| 469| if (empty($locales) || !\is_array($locales)) {
470| throw new SupportedLocalesNotDefined(); 471| } 472| 473| $this->supportedLocales = $locales; 474|
1 C:\xampp\htdocs\site\panorama\vendor\mcamara\laravel-localization\src\Mcamara\LaravelLocalization\LaravelLocalization.php:141 Mcamara\LaravelLocalization\LaravelLocalization::getSupportedLocales()
2 C:\xampp\htdocs\site\panorama\vendor\mcamara\laravel-localization\src\Mcamara\LaravelLocalization\LaravelLocalizationServiceProvider.php:55 Mcamara\LaravelLocalization\LaravelLocalization::__construct()
Hi I have the same problem
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:cache.
2- then delete comment from line.
i hope worked
Please sign in or create an account to participate in this conversation.