Added support for user specific languages

This commit is contained in:
stanjg 2018-05-04 12:56:30 +02:00
parent 7cf79a12cb
commit 9a06647435
No known key found for this signature in database
GPG key ID: 27D9DF9D28935303
3 changed files with 9 additions and 2 deletions
app/Http/Middleware

View file

@ -13,6 +13,7 @@ use Closure;
use Illuminate\Http\Request;
use Illuminate\Foundation\Application;
use Illuminate\Contracts\Config\Repository;
use Illuminate\Support\Facades\Auth;
class LanguageMiddleware
{
@ -47,7 +48,11 @@ class LanguageMiddleware
*/
public function handle(Request $request, Closure $next)
{
$this->app->setLocale($this->config->get('app.locale', 'en'));
if (!Auth::check() || $this->config->get('pterodactyl.lang.global')) {
$this->app->setLocale($this->config->get('app.locale', 'en'));
} else {
$this->app->setLocale(Auth::user()->language);
}
return $next($request);
}