From: Joas Schilling Date: Tue, 26 Apr 2022 09:06:00 +0000 (+0200) Subject: Fix translations with trailing colons X-Git-Tag: v23.0.5rc1~30^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=85b517ad10ad5abd0eef2c4f7d838cf7711e44ba;p=nextcloud-server.git Fix translations with trailing colons Signed-off-by: Joas Schilling --- 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); }