如果lang不存在,如何设置默认lang。它应该重定向到默认lang我使用mcamara/laravel-localization package
我想设置en = default lang,如果我输入url不存在,我想重定向到en
example
1 www.test.com/en/new
2 www.test.com/cn/new <- this url empty it should redirect into url 1
Laravel默认使用en
,你可以指定config/app.php
的后备
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'en',
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en',