🌐 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

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

@@ -10,11 +10,25 @@
<flux:accordion.content>
@php
$languages = [
// Scan lang folder for available languages
$availableLanguages = collect(glob(base_path('lang/*.json')))
->map(fn($file) => pathinfo($file, PATHINFO_FILENAME))
->toArray();
$allLanguages = [
'de' => ['name' => 'Deutsch', 'countries' => ['de-DE', 'de-AT', 'de-CH']],
'en' => ['name' => 'English', 'countries' => ['en-GB', 'en-US', 'en-AU', 'en-CA']],
'es' => ['name' => 'Español', 'countries' => ['es-ES', 'es-CL', 'es-CO']],
'nl' => ['name' => 'Nederlands', 'countries' => ['nl-NL', 'nl-BE']],
'pt' => ['name' => 'Português', 'countries' => ['pt-PT']],
];
// Filter languages based on available JSON files and allowed languages
$languages = array_filter($allLanguages, function($data, $key) use ($availableLanguages) {
return in_array($key, $availableLanguages) &&
count(array_intersect($data['countries'], config('lang-country.allowed'))) > 0;
}, ARRAY_FILTER_USE_BOTH);
$currentLangCountry = session('lang_country', config('lang-country.fallback'));
@endphp