1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Added user setting system and added user-lang option

Supports #115
This commit is contained in:
Dan Brown
2017-01-15 16:27:24 +00:00
parent ee5ded6e1e
commit dabf149411
11 changed files with 124 additions and 25 deletions

View File

@ -0,0 +1,25 @@
<?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);
}
}