diff --git a/.env.example b/.env.example index e6eba87e0..571f93fc2 100644 --- a/.env.example +++ b/.env.example @@ -6,6 +6,7 @@ APP_TIMEZONE=America/New_York APP_CLEAR_TASKLOG=720 APP_DELETE_MINUTES=10 APP_ENVIRONMENT_ONLY=true +LANG_MUST_BE_GLOBAL=false DB_HOST=127.0.0.1 DB_PORT=3306 @@ -26,4 +27,4 @@ MAIL_FROM=no-reply@example.com QUEUE_HIGH=high QUEUE_STANDARD=standard -QUEUE_LOW=low +QUEUE_LOW=low \ No newline at end of file diff --git a/app/Http/Middleware/LanguageMiddleware.php b/app/Http/Middleware/LanguageMiddleware.php index 2e581f58f..f9fa40d04 100644 --- a/app/Http/Middleware/LanguageMiddleware.php +++ b/app/Http/Middleware/LanguageMiddleware.php @@ -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); } diff --git a/config/pterodactyl.php b/config/pterodactyl.php index e06c709ef..f0379533b 100644 --- a/config/pterodactyl.php +++ b/config/pterodactyl.php @@ -161,6 +161,7 @@ return [ */ 'lang' => [ 'in_context' => env('PHRASE_IN_CONTEXT', false), + 'global' => env('LANG_MUST_BE_GLOBAL', false), ], /*