summaryrefslogtreecommitdiffstats
path: root/lib/private/L10N
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2021-03-31 09:54:23 +0200
committerJoas Schilling <coding@schilljs.com>2021-04-20 16:42:05 +0200
commit5a514a9a419f40800e5dc70c33b9de9f33cf7a76 (patch)
tree107f7c16df9e7ae8f51c1db5dcda014ace9eca1e /lib/private/L10N
parent439457d2b4cdc511fbce826764b2b27e30abee50 (diff)
downloadnextcloud-server-5a514a9a419f40800e5dc70c33b9de9f33cf7a76.tar.gz
nextcloud-server-5a514a9a419f40800e5dc70c33b9de9f33cf7a76.zip
Correctly replace all PHP placeholders with the parameters
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/L10N')
-rw-r--r--lib/private/L10N/L10NString.php9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/private/L10N/L10NString.php b/lib/private/L10N/L10NString.php
index ef33babac5a..0722057de02 100644
--- a/lib/private/L10N/L10NString.php
+++ b/lib/private/L10N/L10NString.php
@@ -61,10 +61,6 @@ class L10NString implements \JsonSerializable {
$translations = $this->l10n->getTranslations();
$identityTranslator = $this->l10n->getIdentityTranslator();
- $parameters = $this->parameters;
- // Add $count as %count% as per \Symfony\Contracts\Translation\TranslatorInterface
- $parameters['%count%'] = $this->count;
-
// Use the indexed version as per \Symfony\Contracts\Translation\TranslatorInterface
$identity = $this->text;
if (array_key_exists($this->text, $translations)) {
@@ -84,7 +80,10 @@ class L10NString implements \JsonSerializable {
$identity = str_replace('%n', '%count%', $identity);
- return $identityTranslator->trans($identity, $parameters);
+ // $count as %count% as per \Symfony\Contracts\Translation\TranslatorInterface
+ $text = $identityTranslator->trans($identity, ['%count%' => $this->count]);
+
+ return vsprintf($text, $this->parameters);
}