From 83718ad18afce7793ce16518db904fb378fa090d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 26 Apr 2022 11:06:00 +0200 Subject: Fix translations with trailing colons Signed-off-by: Joas Schilling --- lib/private/L10N/L10NString.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/private/L10N/L10NString.php b/lib/private/L10N/L10NString.php index 33ccc4b1409..73199fdbd1c 100644 --- a/lib/private/L10N/L10NString.php +++ b/lib/private/L10N/L10NString.php @@ -74,10 +74,16 @@ class L10NString implements \JsonSerializable { return 'Can not use pipe character in translations'; } + $beforeIdentity = $identity; $identity = str_replace('%n', '%count%', $identity); + $parameters = []; + if ($beforeIdentity !== $identity) { + $parameters = ['%count%' => $this->count]; + } + // $count as %count% as per \Symfony\Contracts\Translation\TranslatorInterface - $text = $identityTranslator->trans($identity, ['%count%' => $this->count]); + $text = $identityTranslator->trans($identity, $parameters); return vsprintf($text, $this->parameters); } -- cgit v1.2.3