mcamara / laravel-localization

Easy localization for Laravel
MIT License
3.32k stars 507 forks source link

Switching languages in sub route does not change nasted paths #873

Open NoahNxT opened 1 year ago

NoahNxT commented 1 year ago

When switching languages the route does not update the translated path in the url:

Route::prefix(LaravelLocalization::setLocale())
    ->middleware(['localize', 'localeSessionRedirect', 'localizationRedirect', 'localeViewPath'])
    ->group(function () {
        Route::prefix(LaravelLocalization::transRoute('exercises.route'))
            ->group(function () {
                Route::get('/', ExerciseOverviewController::class)->name('exercises');
                Route::get('{exercise}', ExerciseDetailController::class)->name('exercise.detail');
            });
    });

So when I'm on https://platform.lokal.host/en/exercises/1 and I switch to NL for example it does this https://platform.lokal.host/nl/exercises/1 instead of https://platform.lokal.host/nl/oefeningen/1