diff --git a/Classes/Infrastructure/DeepL/DeepLTranslationService.php b/Classes/Infrastructure/DeepL/DeepLTranslationService.php index b8227e4..e4f3a5c 100644 --- a/Classes/Infrastructure/DeepL/DeepLTranslationService.php +++ b/Classes/Infrastructure/DeepL/DeepLTranslationService.php @@ -146,7 +146,7 @@ public function translate(array $texts, string $targetLanguage, ?string $sourceL } $translations = array_map( function ($part) { - return IgnoredTermsUtility::unwrapIgnoredTerms($part); + return IgnoredTermsUtility::unwrapIgnoredTerms($part['text']); }, $returnedData['translations'] ); diff --git a/Tests/Unit/Infrastructure/DeepL/DeepLTranslationServiceTest.php b/Tests/Unit/Infrastructure/DeepL/DeepLTranslationServiceTest.php index 58e5449..8b1d163 100644 --- a/Tests/Unit/Infrastructure/DeepL/DeepLTranslationServiceTest.php +++ b/Tests/Unit/Infrastructure/DeepL/DeepLTranslationServiceTest.php @@ -44,7 +44,7 @@ public static function translateWillCorrectlyTranslateTextsData(): array 'de', null, ['de_foo', 'de_bar', 'de_baz'], - new Response(200, [], json_encode(['translations' => ['de_foo', 'de_bar', 'de_baz']])) + new Response(200, [], json_encode(['translations' => [['text' => 'de_foo'], ['text' => 'de_bar'], ['text' => 'de_baz']]])) ], [ ['foo', 'bar', 'baz'], @@ -66,7 +66,7 @@ public static function translateWillCorrectlyTranslateTextsData(): array 'de', null, ['de_foo', 'cached_de_bar', 'de_baz'], - new Response(200, [], json_encode(['translations' => [0 => 'de_foo', 2 => 'de_baz']])), + new Response(200, [], json_encode(['translations' => [0 => ['text' => 'de_foo'], 2 => ['text' => 'de_baz']]])), [DeepLTranslationService::getEntryIdentifier('bar', 'de') => 'cached_de_bar'] ], [