[BUGFIX] Apply arguments to the default string
authordkd-egerer Sascha Egerer <sascha.egerer@dkd.de>
Fri, 13 Apr 2012 09:48:05 +0000 (11:48 +0200)
committerMarc Bastian Heinrichs <typo3@mbh-software.de>
Sun, 10 Feb 2013 00:18:46 +0000 (01:18 +0100)
Apply given arguments with sprintf to the default string
if no localization string was found.

Change-Id: I42002da0b6224f04bcb340d0e451f4c0f1c929f1
Fixes: #34877
Related: #34874
Releases: 6.1, 6.0, 4.7, 1.3
Reviewed-on: https://review.typo3.org/10385
Reviewed-by: Markus Günther
Tested-by: Markus Günther
Reviewed-by: Marc Bastian Heinrichs
Tested-by: Marc Bastian Heinrichs
typo3/sysext/fluid/Classes/ViewHelpers/TranslateViewHelper.php

index fa312ee..6cfefde 100644 (file)
@@ -110,6 +110,9 @@ class TranslateViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewH
                $value = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate($id, $extensionName, $this->arguments['arguments']);
                if ($value === NULL) {
                        $value = $this->arguments['default'] !== NULL ? $this->arguments['default'] : $this->renderChildren();
+                       if (is_array($this->arguments['arguments'])) {
+                               $value = vsprintf($value, $this->arguments['arguments']);
+                       }
                } elseif ($this->arguments['htmlEscape']) {
                        $value = htmlspecialchars($value);
                }