mcamara / laravel-localization

Easy localization for Laravel
MIT License
3.36k stars 512 forks source link

I want localeSessionRedirect to redirect to localized path but the locale as the second route param. #872

Open Mrbeyond opened 1 year ago

Mrbeyond commented 1 year ago

Is your feature request related to a problem? Please describe. I need to refactor my laravel app to have dynamic company slug to prefix all the routes. This would serve as identifier for each branch and to segrate users for each branch because the distinct branch slug serves as url for the branches . This is working fine.

The issue now is with the localization, \Mcamara\LaravelLocalization\Middleware\LocaleSessionRedirect::class is changing the route url by preeceding the url path with en e.g if the path is /dashbord it would change it to en/dashboard which was the default behaviour but I want the locale to come after the branch slug like /branch/en/dashboard rather it's changing it to /en/branch/dashboard.

Describe the solution you'd like I want to be able change the index or position of the locale redirect on the route param: e.g to be able to set the redirect to any of this /branch/en/dashboard, /branch/dashboard/en or /en/branch/dashboard.

Describe alternatives you've considered Nothing yet.

Additional context Add any other context or screenshots about the feature request here.