From 4af83a6e39e5e4df162a8a27cf6f002ecd140bd9 Mon Sep 17 00:00:00 2001 From: Marvin Kuhl Date: Fri, 29 Sep 2023 17:27:53 +0200 Subject: [PATCH] returns an array if there are multiple to be able to handle plural forms --- Classes/Http/TranslationRequestMiddleware.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Classes/Http/TranslationRequestMiddleware.php b/Classes/Http/TranslationRequestMiddleware.php index 207d073..b7688f3 100644 --- a/Classes/Http/TranslationRequestMiddleware.php +++ b/Classes/Http/TranslationRequestMiddleware.php @@ -157,7 +157,15 @@ class TranslationRequestMiddleware implements MiddlewareInterface \ARRAY_FILTER_USE_KEY ); $result[$package] += \array_map( - static fn($value) => $value[0]['target'], + static function ($value) { + if (\count($value) === 1) { + return $value[0]['target']; + } + return \array_map( + static fn ($value) => $value['target'], + $value + ); + }, $matchingUnits ); }