mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-11-26 10:13:38 +08:00
24 lines
544 B
PHP
24 lines
544 B
PHP
<?php namespace BookStack\Http\Middleware;
|
|
|
|
use Carbon\Carbon;
|
|
use Closure;
|
|
|
|
class Localization
|
|
{
|
|
/**
|
|
* Handle an incoming request.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @param \Closure $next
|
|
* @return mixed
|
|
*/
|
|
public function handle($request, Closure $next)
|
|
{
|
|
$defaultLang = config('app.locale');
|
|
$locale = setting()->getUser(user(), 'language', $defaultLang);
|
|
app()->setLocale($locale);
|
|
Carbon::setLocale($locale);
|
|
return $next($request);
|
|
}
|
|
}
|