add detection for Accept-Language
This commit is contained in:
parent
cbec1d3869
commit
e0a4667cc8
@ -16,9 +16,11 @@ class Internationalization
|
||||
session(['locale' => Cookie::get('locale')]);
|
||||
}
|
||||
|
||||
if (Session::has('locale') && Arr::exists(config('locales'), session('locale'))) {
|
||||
if (Session::has('locale')) {
|
||||
// Set app locale dynamically
|
||||
App::setLocale(session('locale'));
|
||||
} else {
|
||||
App::setLocale($request->getPreferredLanguage());
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
|
@ -74,7 +74,7 @@ return [
|
||||
|
|
||||
*/
|
||||
|
||||
'locale' => 'zh-CN',
|
||||
'locale' => 'zh_CN',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -9,6 +9,6 @@ return [
|
||||
| Available Languages
|
||||
|
|
||||
*/
|
||||
'zh-CN' => '简体中文',
|
||||
'zh_CN' => '简体中文',
|
||||
'en' => 'English'
|
||||
];
|
||||
|
Loading…
Reference in New Issue
Block a user