code: public function onKernelRequest(GetResponseEvent $event): void
      {
          if (!$this->scopeMatcher->isContaoRequest($event->getRequest())) {
              return;
          }
  
          $request = $event->getRequest();
          $request->attributes->set('_locale', $this->getLocale($request));
      }
docs: Sets the default locale based on the request or session.