diff --git a/Classes/Client.php b/Classes/Client.php index 91746cbf..304f5f3b 100644 --- a/Classes/Client.php +++ b/Classes/Client.php @@ -134,7 +134,17 @@ public function createGlossary( ): GlossaryInfo { $prepareEntriesForGlossary = []; foreach ($entries as $entry) { - $prepareEntriesForGlossary[$entry['source']] = $entry['target']; + /* + * as the version without trimming in TCA is already published, + * we trim a second time here + * to avoid errors in DeepL client + */ + $source = trim($entry['source']); + $target = trim($entry['target']); + if (empty($source) || empty($target)) { + continue; + } + $prepareEntriesForGlossary[$source] = $target; } try { return $this->translator->createGlossary( diff --git a/Configuration/TCA/tx_wvdeepltranslate_glossaryentry.php b/Configuration/TCA/tx_wvdeepltranslate_glossaryentry.php index 75be7a5a..29e4305f 100644 --- a/Configuration/TCA/tx_wvdeepltranslate_glossaryentry.php +++ b/Configuration/TCA/tx_wvdeepltranslate_glossaryentry.php @@ -84,11 +84,16 @@ 'term' => [ 'label' => 'LLL:EXT:wv_deepltranslate/Resources/Private/Language/locallang.xlf:entry.source', 'l10n_mode' => '', - 'config' => [ - 'type' => 'input', - // @deprecated with v12. Adjusted for v12+ in `Overrides/tx_wvdeepltranslate_glossaryentry.php' - 'eval' => 'required', - ], + 'config' => (new \TYPO3\CMS\Core\Information\Typo3Version())->getMajorVersion() >= 12 + ? [ + 'type' => 'input', + 'required' => true, + 'eval' => 'trim', + ] + : [ + 'type' => 'input', + 'eval' => 'trim,reqiured', + ], ], ], ];