hasHeader("Accept-Language")) { // We only keep the primary language passed via the header. $lang = head(explode(',', $request->header("Accept-Language"))); } } // If the language is not available (or partial), strings will be translated using the fallback language. App::setLocale($lang); return $next($request); } }