@ARCANEDEV I see you posted some answer in the mcamara GIT earlier today... does your package solve this problem ?
It seems pretty good !
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi guys, I have successfully integrated the "mcamara/laravel-localization" package to my app for the most part.
Routes translate fine, ex.: app.dev/login --- becomes ---> app.dev/fr/connexion The problem is there seems to be no session logged when the user authenticates... If I have logged in from the french version
I am redirected to "/" instead of "/fr/"
The localeSessionRedirect middleware does not seem to work. It is in my kernel.php as stated in the docs.
Question : Am I supposed to see a session var or cookie, if I check my inspector --> ressources, under chrome ? If so its not working.
Here is part of my routes file :
/* Localized routes*/
Route::group(['prefix' => LaravelLocalization::setLocale(),
'middleware' => [ 'localeSessionRedirect', 'localize', 'web' ]], function() {
// Home
Route::get(LaravelLocalization::transRoute('routes.home'),array(
'as' => 'home',
'uses' => 'HomeController@home'
));
// Food
Route::get(LaravelLocalization::transRoute('routes.food'),array(
'as' => 'food',
'uses' => 'FoodController@food'
));
});
/* Laravel Auth + Socialite + mcamara localization */
Route::group(['prefix' => LaravelLocalization::setLocale(),
'middleware' => [ 'localeSessionRedirect', 'localize', 'web' ]], function() {
// Authentication Routes
// Login Get
Route::get(LaravelLocalization::transRoute('routes.login'),
array('as' => 'showLoginForm', 'uses' => 'Auth\AuthController@showLoginForm') );
// Login Post
Route::post(LaravelLocalization::transRoute('routes.login'),
array('as' => 'login', 'uses' => 'Auth\AuthController@login') );
// Logout Get
Route::get(LaravelLocalization::transRoute('routes.logout'),
array('as' => 'logout', 'uses' => 'Auth\AuthController@logout') );
// Registration Routes...
// Register Get
Route::get(LaravelLocalization::transRoute('routes.register'),
array('as' => 'showRegistrationForm', 'uses' => 'Auth\AuthController@showRegistrationForm') );
// Register Post
Route::post(LaravelLocalization::transRoute('routes.register'),
array('as' => 'register', 'uses' => 'Auth\AuthController@register') );
Here is my kernel.php
//Custom
'localize' => \Mcamara\LaravelLocalization\Middleware\LaravelLocalizationRoutes::class,
'localeSessionRedirect' => \Mcamara\LaravelLocalization\Middleware\LocaleSessionRedirect::class
My 'hideDefaultLocaleInURL' => false, and 'useAcceptLanguageHeader' => true.
Any kind of hint might help.. I read somewhere moving the posts from the localized routes for the login might help but did not, but Im still open to try again if thats the reason this is not persistent :) thx guys
Please or to participate in this conversation.