private function loadLanguages(): iterable
    {
        if (method_exists($this->languageService, 'loadLanguageListByCode')) {
            return $this->languageService->loadLanguageListByCode($this->languageCodes);
        }

        // Deprecated: Remove when support for eZ kernel < 7.5 ends

        $languages = [];

        foreach ($this->languageCodes as $languageCode) {
            try {
                $language = $this->languageService->loadLanguage($languageCode);
            } catch (NotFoundException $e) {
                continue;
            }

            $languages[] = $language;
        }

        return $languages;
    }