From 1554e4ba7f21be2b2fc2cdfb2ffaec9a4da1d69c Mon Sep 17 00:00:00 2001 From: Ferdinand Kuhl Date: Tue, 15 Aug 2023 14:18:45 +0200 Subject: [PATCH 1/2] adjust to woodpecker v1.0 --- .woodpecker/code-style.yml | 2 +- .woodpecker/functional-tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.woodpecker/code-style.yml b/.woodpecker/code-style.yml index bfd94b0..91b7fba 100644 --- a/.woodpecker/code-style.yml +++ b/.woodpecker/code-style.yml @@ -1,4 +1,4 @@ -pipeline: +steps: code-style: image: composer commands: diff --git a/.woodpecker/functional-tests.yml b/.woodpecker/functional-tests.yml index d5e2d19..21d232b 100644 --- a/.woodpecker/functional-tests.yml +++ b/.woodpecker/functional-tests.yml @@ -13,7 +13,7 @@ matrix: - FLOW_VERSION: 8.3 PHP_VERSION: 8.1 -pipeline: +steps: functional-tests: image: "thecodingmachine/php:${PHP_VERSION}-v4-cli" environment: From 4af83a6e39e5e4df162a8a27cf6f002ecd140bd9 Mon Sep 17 00:00:00 2001 From: Marvin Kuhl Date: Fri, 29 Sep 2023 17:27:53 +0200 Subject: [PATCH 2/2] 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 ); }