mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-09 06:46:08 -06:00
add isset for HTTP_ACCEPT_LANGUAGE
This commit is contained in:
parent
81d318d5d8
commit
5ac2789a27
@ -16,7 +16,7 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
{
|
{
|
||||||
//Auto Language Switcher
|
//Auto Language Switcher
|
||||||
view()->composer('*', function ($view) {
|
view()->composer('*', function ($view) {
|
||||||
if (config('advs.lang_switcher_for_browser') and is_null(Request()->session()->get('_locale'))) {
|
if (config('advs.lang_switcher_for_browser') and is_null(Request()->session()->get('_locale')) and isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
||||||
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);//Get Browser Language
|
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);//Get Browser Language
|
||||||
$acceptLang = config('streams::locales.enabled'); //Supported Language
|
$acceptLang = config('streams::locales.enabled'); //Supported Language
|
||||||
$lang = in_array($lang, $acceptLang) ? $lang : config('streams::locales.default', 'en');
|
$lang = in_array($lang, $acceptLang) ? $lang : config('streams::locales.default', 'en');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user