protected function getBaseLanguage()
    {
        $languageRepository = $this->languageManager->getLanguageRepository();

        // Tries to fetch the current language from the request
        if (null !== $this->request) {
            $languages = $this->request->getLanguages();

            $alLanguage = $languageRepository->fromLanguageName($languages[1]);
            if (null !== $alLanguage) {
                return $alLanguage;
            }
        // @codeCoverageIgnoreStart
        }
        // @codeCoverageIgnoreEnd

        // Fetches the current language from the main language when the adding one is not the main language
        if ($this->mainLanguage->getId() != $this->languageManager->get()->getId()) {
            return $this->mainLanguage;
        }

        return $languageRepository->firstOne();
    }