getAvailableLanguages($this->getBackendUser(), true, $pageIdDefaultLanguage); $languageRows = []; foreach ($languages as $language) { $languageId = $language->getLanguageId(); if ($languageId > 0) { $iso = $language->getLocale()->getLanguageCode(); } else { $iso = 'DEF'; } $languageRows[$languageId] = [ 'uid' => $languageId, 'title' => $language->getTitle(), 'iso' => $iso, 'flagIconIdentifier' => $language->getFlagIdentifier(), ]; if (empty($iso)) { // No iso code could be found. This is currently possible in the system but discouraged. // So, code within FormEngine has to be suited to work with an empty iso code. However, // it may impact certain multi language scenarios, so we add a flash message hinting for // incomplete configuration here. // It might be possible to convert this to a non-catchable exception later if // it iso code is enforced on a different layer of the system (tca required + migration wizard). // @todo: This could be relaxed again if flex form language handling is extracted, // @todo: since the rest of the FormEngine code does not rely on iso code? $message = sprintf( $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:error.missingLanguageIsocode'), $language->getLocale()->getLanguageCode(), $languageId ); $flashMessage = new FlashMessage( $message, '', ContextualFeedbackSeverity::ERROR ); $defaultFlashMessageQueue = $this->flashMessageService->getMessageQueueByIdentifier(); $defaultFlashMessageQueue->enqueue($flashMessage); } } $result['systemLanguageRows'] = $languageRows; return $result; } protected function getLanguageService(): LanguageService { return $GLOBALS['LANG']; } protected function getBackendUser(): BackendUserAuthentication { return $GLOBALS['BE_USER']; } }