Files
einundzwanzig-app/app/Http/Middleware/DomainMiddleware.php
HolgerHatGarKeineNode 2cfd7abc07 🌐 Replace manual language selection with reusable language selector component and add Hungarian translations
- Replaced inline language selection logic in `profile.blade.php` with `<x-einundzwanzig.language-selector>`.
- Introduced Hungarian (`hu.json`) translations for improved multilingual support.
- Updated `DomainMiddleware` to include settings for Hungarian locale and portal branding.
2025-11-23 22:34:38 +01:00

45 lines
1.2 KiB
PHP

<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
use Symfony\Component\HttpFoundation\Response;
class DomainMiddleware
{
public function handle(Request $request, Closure $next): Response
{
$domain = $request->getHost(); // Erkennt die aktuelle Domain (via CNAME)
// domains
$domainArray = [
'portal.eenentwintig.net' => [
'locale' => 'nl',
'lang_country' => 'nl-NL',
'app_name' => 'EENENTWINTIG Portaal',
],
'portal.huszonegy.world/' => [
'locale' => 'hu',
'lang_country' => 'hu-HU',
'app_name' => ' HUSZONEGY Portál',
],
];
// App-Locale dynamisch setzen
if (isset($domainArray[$domain]['locale'])) {
session([
'lang_country' => $domainArray[$domain]['lang_country'],
]);
config([
'app.name' => $domainArray[$domain]['app_name'],
'app.domain_country' => $domainArray[$domain]['locale'],
]);
App::setLocale($domainArray[$domain]['locale']);
}
return $next($request);
}
}