diff --git a/Classes/Controller/LocalizationModuleController.php b/Classes/Controller/LocalizationModuleController.php index e260c22..180cfba 100644 --- a/Classes/Controller/LocalizationModuleController.php +++ b/Classes/Controller/LocalizationModuleController.php @@ -126,6 +126,7 @@ public function initialize(ServerRequestInterface $request): void // @extensionScannerIgnoreLine $this->id = (int)($request->getQueryParams()['id'] ?? $request->getParsedBody()['id'] ?? 0); $this->srcPID = (int)($request->getQueryParams()['srcPID'] ?? $request->getParsedBody()['srcPID'] ?? 0); + $this->previewLanguage = (int)($request->getQueryParams()['export_xml_forcepreviewlanguage'] ?? $request->getParsedBody()['export_xml_forcepreviewlanguage'] ?? 0); $this->menuConfig(); } @@ -469,6 +470,7 @@ protected function excelExportImportAction(L10nConfiguration $l10nConfiguration) $importExcel = GeneralUtility::_POST('import_excel'); $exportExcel = GeneralUtility::_POST('export_excel'); $checkExports = GeneralUtility::_POST('check_exports') ?? false; + $export_xml_forcepreviewlanguage_only = GeneralUtility::_POST('export_xml_forcepreviewlanguage_only'); if ($importAsDefaultLanguage) { $this->l10nBaseService->setImportAsDefaultLanguage(true); @@ -510,7 +512,7 @@ protected function excelExportImportAction(L10nConfiguration $l10nConfiguration) if ($export_xml_forcepreviewlanguage > 0) { $viewClass->setForcedSourceLanguage($export_xml_forcepreviewlanguage); } - if (GeneralUtility::_POST('export_xml_forcepreviewlanguage_only')) { + if ($export_xml_forcepreviewlanguage_only) { $viewClass->setOnlyForcedSourceLanguage(); } if ($this->MOD_SETTINGS['onlyChangedContent'] ?? false) { @@ -581,6 +583,9 @@ protected function excelExportImportAction(L10nConfiguration $l10nConfiguration) 'existingExportsOverview' => $existingExportsOverview, 'isImport' => $isImport, 'importSuccess' => $importSuccess, + 'check_exports' => $checkExports, + 'import_asdefaultlanguage' => $importAsDefaultLanguage, + 'export_xml_forcepreviewlanguage_only' => $export_xml_forcepreviewlanguage_only, 'previewLanguageMenu' => $this->makePreviewLanguageMenu(), 'flashMessageHtml' => $flashMessageHtml, 'internalFlashMessage' => $internalFlashMessage, diff --git a/Classes/View/AbstractExportView.php b/Classes/View/AbstractExportView.php index 859f9e2..e3bd21b 100644 --- a/Classes/View/AbstractExportView.php +++ b/Classes/View/AbstractExportView.php @@ -199,22 +199,23 @@ public function setFilename(): void $fileType = 'catxml'; } - $sourceLanguageId = $this->l10ncfgObj->getForcedSourceLanguage() ?: 0; - $sourceLanguageConfiguration = $this->site->getAvailableLanguages($this->getBackendUser())[$sourceLanguageId] ?? null; + $sourceLanguageId = $this->forcedSourceLanguage ?: 0; + try { + $sourceLanguageConfiguration = $this->site->getLanguageById($sourceLanguageId); + } catch(\InvalidArgumentException $e) { + $sourceLanguageConfiguration = null; + } if ($sourceLanguageConfiguration instanceof SiteLanguage) { - if ($this->typo3Version->getMajorVersion() < 12) { - $sourceLang = $sourceLanguageConfiguration->getLocale() ?: $sourceLanguageConfiguration->getTwoLetterIsoCode(); - } else { - $sourceLang = $sourceLanguageConfiguration->getLocale()->getName() ?: $sourceLanguageConfiguration->getLocale()->getLanguageCode(); - } + $sourceLang = $sourceLanguageConfiguration->getHreflang(); + } + try { + $targetLanguageConfiguration = $this->site->getLanguageById($this->targetLanguage); + } catch(\InvalidArgumentException $e) { + $targetLanguageConfiguration = null; } $targetLanguageConfiguration = $this->site->getAvailableLanguages($this->getBackendUser())[$this->targetLanguage] ?? null; if ($targetLanguageConfiguration instanceof SiteLanguage) { - if ($this->typo3Version->getMajorVersion() < 12) { - $targetLang = $targetLanguageConfiguration->getLocale() ?: $targetLanguageConfiguration->getTwoLetterIsoCode(); - } else { - $targetLang = $targetLanguageConfiguration->getLocale()->getName() ?: $targetLanguageConfiguration->getLocale()->getLanguageCode(); - } + $targetLang = $targetLanguageConfiguration->getHreflang(); } if ($sourceLang !== '' && $targetLang !== '') { $fileNamePrefix = (trim($this->l10ncfgObj->getFileNamePrefix())) ? $this->l10ncfgObj->getFileNamePrefix() . '_' . $fileType : $fileType; diff --git a/Resources/Private/Partials/LocalizationModule/Modules/ExportExcel.html b/Resources/Private/Partials/LocalizationModule/Modules/ExportExcel.html index bf9b0d1..44aa0bc 100644 --- a/Resources/Private/Partials/LocalizationModule/Modules/ExportExcel.html +++ b/Resources/Private/Partials/LocalizationModule/Modules/ExportExcel.html @@ -9,7 +9,7 @@