Skip to content

Commit

Permalink
Merge pull request #45 from sitegeist/bugfix-ignored-terms
Browse files Browse the repository at this point in the history
BUGFIX: $part is an array, containing "text"
  • Loading branch information
gradinarufelix authored Jul 27, 2024
2 parents f186992 + cbc6a80 commit f4c2c07
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Classes/Infrastructure/DeepL/DeepLTranslationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand All @@ -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']
],
[
Expand Down

0 comments on commit f4c2c07

Please sign in to comment.