Added support for user specific languages
This commit is contained in:
parent
7cf79a12cb
commit
9a06647435
3 changed files with 9 additions and 2 deletions
|
@ -6,6 +6,7 @@ APP_TIMEZONE=America/New_York
|
||||||
APP_CLEAR_TASKLOG=720
|
APP_CLEAR_TASKLOG=720
|
||||||
APP_DELETE_MINUTES=10
|
APP_DELETE_MINUTES=10
|
||||||
APP_ENVIRONMENT_ONLY=true
|
APP_ENVIRONMENT_ONLY=true
|
||||||
|
LANG_MUST_BE_GLOBAL=false
|
||||||
|
|
||||||
DB_HOST=127.0.0.1
|
DB_HOST=127.0.0.1
|
||||||
DB_PORT=3306
|
DB_PORT=3306
|
||||||
|
|
|
@ -13,6 +13,7 @@ use Closure;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Foundation\Application;
|
use Illuminate\Foundation\Application;
|
||||||
use Illuminate\Contracts\Config\Repository;
|
use Illuminate\Contracts\Config\Repository;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
class LanguageMiddleware
|
class LanguageMiddleware
|
||||||
{
|
{
|
||||||
|
@ -47,7 +48,11 @@ class LanguageMiddleware
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next)
|
public function handle(Request $request, Closure $next)
|
||||||
{
|
{
|
||||||
|
if (!Auth::check() || $this->config->get('pterodactyl.lang.global')) {
|
||||||
$this->app->setLocale($this->config->get('app.locale', 'en'));
|
$this->app->setLocale($this->config->get('app.locale', 'en'));
|
||||||
|
} else {
|
||||||
|
$this->app->setLocale(Auth::user()->language);
|
||||||
|
}
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,6 +161,7 @@ return [
|
||||||
*/
|
*/
|
||||||
'lang' => [
|
'lang' => [
|
||||||
'in_context' => env('PHRASE_IN_CONTEXT', false),
|
'in_context' => env('PHRASE_IN_CONTEXT', false),
|
||||||
|
'global' => env('LANG_MUST_BE_GLOBAL', false),
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue