warn_legacy_locale($language, "APP_LOCALE in .env is set to"); if ($settings = Setting::getSettings()) { // User's preference if (($request->user()) && ($request->user()->locale)) { $language = $request->user()->locale; $this->warn_legacy_locale($language, "username ".$request->user()->username." (".$request->user()->id.") has a language"); // App setting preference } elseif ($settings->locale != '') { $language = $settings->locale; $this->warn_legacy_locale($language, "App Settings is set to"); } } app()->setLocale(Helper::mapLegacyLocale($language)); return $next($request); } }