code: public function onRoute(MvcEvent $e)
      {
          $routeMatch = $e->getRouteMatch();
          if (0 !== strpos($routeMatch->getMatchedRouteName(), 'lang')) {
              // We do not have a language enabled route here.
              // but we need to provide a language to the navigation container
              $lang = $this->detectLanguage($e);
              $this->setLocale($e, $lang);
              return;
          }
          $language = $routeMatch->getParam('lang', '__NOT_SET__');
          if ($this->localeService->isLanguageSupported($language)) {
              $this->setLocale($e, $language);
          } else {
              $e->setError(Application::ERROR_ROUTER_NO_MATCH);
              $e->setTarget($this);
              $eventManager = $e->getApplication()->getEventManager();
              $eventManager->setEventPrototype($e);
              $result = $eventManager->trigger(MvcEvent::EVENT_DISPATCH_ERROR, $e);
              
              return $result->last();
          }
      }
docs: Listen to the "route" event
  
  @param  MvcEvent $e
  @return null