|
@@ -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){
|