returns an array if there are multiple to be able to handle plural forms

This commit is contained in:
Marvin Kuhl 2023-09-29 17:27:53 +02:00
parent 1554e4ba7f
commit 4af83a6e39

View file

@ -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
);
}