E5E6 [Translation] Extract translatable content on twig set by natewiebe13 · Pull Request #42160 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,10 @@ protected function doEnterNode(Node $node, Environment $env): Node
$this->getReadDomainFromArguments($node->getNode('arguments'), 1),
];
} elseif (
$node instanceof FilterExpression &&
'trans' === $node->getNode('filter')->getAttribute('value') &&
$node->getNode('node') instanceof FunctionExpression &&
't' === $node->getNode('node')->getAttribute('name')
$node instanceof FunctionExpression &&
't' === $node->getAttribute('name')
) {
$nodeArguments = $node->getNode('node')->getNode('arguments');
$nodeArguments = $node->getNode('arguments');

if ($nodeArguments->getIterator()->current() instanceof ConstantExpression) {
$this->messages[] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public function getExtractData()
['{% set foo = "new key" | trans %}', ['new key' => 'messages']],
['{{ 1 ? "new key" | trans : "another key" | trans }}', ['new key' => 'messages', 'another key' => 'messages']],
['{{ t("new key") | trans() }}', ['new key' => 'messages']],
['{% set foo = t("new key") %}', ['new key' => 'messages']],
['{{ t("new key", {}, "domain") | trans() }}', ['new key' => 'domain']],
['{{ 1 ? t("new key") | trans : t("another key") | trans }}', ['new key' => 'messages', 'another key' => 'messages']],

Expand Down
0