title: Laravel localization and routes from Jetstream / Fortify
body: <p>I have this new Laravel project to work on. We would like to make it available in multiple languages.</p>
  <p>I started the project with JetStream. Routes for authentication and such are automatically handled by JetStream / Fortify. I then added <a href="https://github.com/mcamara/laravel-localization" rel="nofollow noreferrer">https://github.com/mcamara/laravel-localization</a> to handle the localization. it works fine for the routes I created myself :</p>
  <pre><code>Route::group(
      [
          'prefix' =&gt; LaravelLocalization::setLocale(),
          'middleware' =&gt; [ 'localeSessionRedirect', 'localizationRedirect', 'localeViewPath' ]
      ], function()
  {
      Route::get('/', function () {
          return view('welcome');
      });
  
      Route::middleware(['auth:sanctum', 'verified'])-&gt;get('/dashboard', function () {
          return view('dashboard');
      })-&gt;name('dashboard');
  });
  </code></pre>
  <p>But how can I set the group, prefix and middleware on the routes handled by Jetstream and Fortify?</p>
  <p>[EDIT]</p>
  <p>So after some suggestions from @TEFO, I'm trying to add a middleware to handle setting the locale. Added :</p>
  <p>Fortify.php :</p>
  <pre><code>    'path' =&gt; '{lang}',
      'middleware' =&gt; ['web', 'setLang']
  </code></pre>
  <p>new middleware setLang :</p>
  <pre><code>class SetLang {
      /**
       * Handle an incoming request.
       *
       * @param \Illuminate\Http\Request $request
       * @param \Closure $next
       * @return mixed
       */
      public function handle(\Illuminate\Http\Request $request, Closure $next) {
          // $lang = 'en';
          // $request-&gt;attributes-&gt;add(['lang' =&gt; 'en']);
          $request-&gt;route()-&gt;setParameter('lang', 'en');
          // $request-&gt;request-&gt;set('lang', 'en');
  
          return $next($request);
      }
  }
  </code></pre>
  <p>Added the middleware to <code>$routeMiddleware</code>.</p>
  <p>I'm receiving this error when trying to reach <code>http://mylaravel/en/login</code> :</p>
  <pre><code>ErrorException
  Missing required parameters for [Route: login] [URI: {lang}/login]. (View: /var/www/resources/views/auth/login.blade.php)
  </code></pre>