fixed language switching in the frontend

This commit is contained in:
Codex Agent
2025-12-02 13:31:58 +01:00
parent 28539754a7
commit dd3198cb79
20 changed files with 395 additions and 203 deletions

View File

@@ -17,6 +17,7 @@ use App\Http\Controllers\Tenant\EventPhotoArchiveController;
use App\Http\Controllers\TenantAdminAuthController;
use App\Http\Controllers\TenantAdminGoogleController;
use App\Models\Package;
use App\Support\LocaleConfig;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use Inertia\Inertia;
@@ -24,20 +25,8 @@ use Inertia\Inertia;
require __DIR__.'/auth.php';
require __DIR__.'/settings.php';
$configuredLocales = array_filter(array_map(
static fn ($value) => trim((string) $value),
explode(',', (string) env('APP_SUPPORTED_LOCALES', ''))
));
if (empty($configuredLocales)) {
$configuredLocales = array_filter([
config('app.locale'),
config('app.fallback_locale'),
]);
}
$supportedLocales = array_values(array_unique($configuredLocales ?: ['de', 'en']));
$localePattern = implode('|', $supportedLocales);
$supportedLocales = LocaleConfig::normalized();
$localePattern = LocaleConfig::routePattern();
$rewritePath = static function (string $path, string $locale): string {
$normalized = '/'.ltrim($path, '/');
@@ -82,9 +71,6 @@ $determinePreferredLocale = static function (Request $request) use ($supportedLo
Route::prefix('{locale}')
->where(['locale' => $localePattern])
->middleware([
\App\Http\Middleware\SetLocaleFromRequest::class,
])
->group(function () {
Route::get('/', [MarketingController::class, 'index'])->name('marketing.home');