Skip to content

Commit cef078a

Browse files
committed
{translate} accepts parameters
1 parent 16b7079 commit cef078a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/Bridges/ApplicationLatte/Nodes/TranslateNode.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,15 @@ public static function create(Tag $tag): \Generator
3434
$tag->outputMode = $tag::OutputKeepIndentation;
3535

3636
$node = new static;
37+
$args = $tag->parser->parseArguments();
3738
$node->modifier = $tag->parser->parseModifier();
3839
$node->modifier->escape = true;
3940
if ($tag->void) {
4041
return new NopNode;
4142
}
4243

4344
[$node->content] = yield;
44-
array_unshift($node->modifier->filters, new Php\FilterNode(new Php\IdentifierNode('translate')));
45+
array_unshift($node->modifier->filters, new Php\FilterNode(new Php\IdentifierNode('translate'), $args->toArguments()));
4546
return $node;
4647
}
4748

tests/Bridges.Latte3/{translate}.phpt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ Assert::match(
2727
$latte->compile('{translate}abc{/translate}'),
2828
);
2929

30+
Assert::contains(
31+
'echo LR\Filters::convertTo($ʟ_fi, \'html\', $this->filters->filterContent(\'translate\', $ʟ_fi, \'abc\', 10, 20)) /* line 1 */;',
32+
$latte->compile('{translate 10, 20}abc{/translate}'),
33+
);
34+
3035
Assert::match(
3136
<<<'XX'
3237
%A%

0 commit comments

Comments
 (0)