Nathaniel van Diepen 7 anni fa
parent
commit
f077614689
1 ha cambiato i file con 6 aggiunte e 5 eliminazioni
  1. 6 5
      Data/template.class.php

+ 6 - 5
Data/template.class.php

@@ -95,15 +95,16 @@
 			}, $output);
 			// Handle {gettext}
 			$output = preg_replace_callback(static::$regex['gettext'], function($matches){
-				$output = "<?= _(sprintf(";
-				foreach(array_slice($matches, 1) as $item){
+				$output = "<?= sprintf(_(";
+				$output .= "{$matches[1]})";
+				foreach(array_slice($matches, 2) as $item){
 					if(preg_match(static::$regex['gettext_string'], $item)){
-						$output .= $item;
+						$output .= ", $item";
 					}else{
-						$output .= "(\$data['{$item}'] ?? '')";
+						$output .= ", (\$data['{$item}'] ?? '')";
 					}
 				}
-				return "{$output})); ?>";
+				return "{$output}); ?>";
 			}, $output);
 			// Handle {=expression}
 			$output = preg_replace_callback(static::$regex['echo'], function($matches){