🌐 Introduce dynamic domain-based locale and country handling

- Added `DomainMiddleware` to dynamically set locale, language-country session, and app name based on domain.
- Updated views and components to leverage `lang_country` session for language and region-specific content.
- Enhanced country parameter retrieval with `config('app.domain_country')` as fallback.
- Refined language filtering by scanning available language files dynamically.
- Added language-specific assets and translations (`nl.json`, `es.json`) with improved language-region associations.
- Updated `app-logo-icon` to display region-specific images or default SVGs.
- Improved views with cleaner, dynamic rendering and session-aware functionalities.
This commit is contained in:
HolgerHatGarKeineNode
2025-11-23 20:45:29 +01:00
parent c48455a6be
commit 6f7ee806ae
32 changed files with 962 additions and 42 deletions

View File

@@ -36,9 +36,12 @@ class extends Component {
public ?string $url = null;
public ?string $lnurl = null;
public ?string $qrCode = null;
public string $currentLangCountry = 'de-DE';
public function mount(): void
{
$this->currentLangCountry = session('lang_country');
// Nur beim ersten Mount initialisieren
if ($this->k1 === null) {
$this->k1 = bin2hex(str()->random(32));
@@ -64,7 +67,7 @@ class extends Component {
Auth::loginUsingId($user->id);
Session::regenerate();
$this->redirectIntended(
default: route('dashboard', ['country' => str(session('lang_country', 'de'))->after('-')->lower()], absolute: false),
default: route('dashboard', ['country' => str(session('lang_country', config('app.domain_country')))->after('-')->lower()], absolute: false),
navigate: true,
);
return;
@@ -85,9 +88,12 @@ class extends Component {
RateLimiter::clear($this->throttleKey());
Session::regenerate();
session([
'lang_country' => $this->currentLangCountry,
]);
$this->redirectIntended(
default: route('dashboard', ['country' => str(session('lang_country', 'de'))->after('-')->lower()], absolute: false),
default: route('dashboard', ['country' => str(session('lang_country', config('app.domain_country')))->after('-')->lower()], absolute: false),
navigate: true
);
}
@@ -134,8 +140,12 @@ class extends Component {
\App\Models\User::find(1)
->notify(new ModelCreatedNotification($user, 'users'));
auth()->login($user);
Session::regenerate();
session([
'lang_country' => $this->currentLangCountry,
]);
return to_route('dashboard', ['country' => str(session('lang_country', 'de'))->after('-')->lower()]);
return to_route('dashboard', ['country' => str(session('lang_country', config('app.domain_country')))->after('-')->lower()]);
}
return true;