[TASK] Improve TranslateViewHelper compiling 83/55983/3
authorMathias Brodala <mbrodala@pagemachine.de>
Fri, 2 Mar 2018 08:21:42 +0000 (09:21 +0100)
committerFrank Naegler <frank.naegler@typo3.org>
Fri, 2 Mar 2018 11:33:17 +0000 (12:33 +0100)
Simplify string interpolation with positional arguments.

Resolves: #82454
Releases: master
Change-Id: If2bb56be5bba183ff5decbbb4a8f61eb01c61792
Reviewed-on: https://review.typo3.org/55983
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
typo3/sysext/fluid/Classes/ViewHelpers/TranslateViewHelper.php

index 0f56911..c12c584 100644 (file)
@@ -107,15 +107,9 @@ class TranslateViewHelper extends AbstractViewHelper
     public function compile($argumentsName, $closureName, &$initializationPhpCode, ViewHelperNode $node, TemplateCompiler $compiler)
     {
         return sprintf(
-            '\\%s::translate(%s[\'key\'] ?? %s[\'id\'], %s[\'extensionName\'] ?? $renderingContext->getControllerContext()->getRequest()->getControllerExtensionName(), %s[\'arguments\'], %s[\'languageKey\'], %s[\'alternativeLanguageKeys\']) ?? %s[\'default\'] ?? %s()',
+            '\\%1$s::translate(%2$s[\'key\'] ?? %2$s[\'id\'], %2$s[\'extensionName\'] ?? $renderingContext->getControllerContext()->getRequest()->getControllerExtensionName(), %2$s[\'arguments\'], %2$s[\'languageKey\'], %2$s[\'alternativeLanguageKeys\']) ?? %2$s[\'default\'] ?? %3$s()',
             LocalizationUtility::class,
             $argumentsName,
-            $argumentsName,
-            $argumentsName,
-            $argumentsName,
-            $argumentsName,
-            $argumentsName,
-            $argumentsName,
             $closureName
         );
     }