Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ab9ad6b

Browse filesBrowse files
natewiebe13fabpot
authored andcommitted
[Translation] Extract translatable content on twig set
1 parent 803a998 commit ab9ad6b
Copy full SHA for ab9ad6b

File tree

2 files changed

+4
-5
lines changed
Filter options

2 files changed

+4
-5
lines changed

‎src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php
+3-5Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,10 @@ protected function doEnterNode(Node $node, Environment $env): Node
6969
$this->getReadDomainFromArguments($node->getNode('arguments'), 1),
7070
];
7171
} elseif (
72-
$node instanceof FilterExpression &&
73-
'trans' === $node->getNode('filter')->getAttribute('value') &&
74-
$node->getNode('node') instanceof FunctionExpression &&
75-
't' === $node->getNode('node')->getAttribute('name')
72+
$node instanceof FunctionExpression &&
73+
't' === $node->getAttribute('name')
7674
) {
77-
$nodeArguments = $node->getNode('node')->getNode('arguments');
75+
$nodeArguments = $node->getNode('arguments');
7876

7977
if ($nodeArguments->getIterator()->current() instanceof ConstantExpression) {
8078
$this->messages[] = [

‎src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public function getExtractData()
6666
['{% set foo = "new key" | trans %}', ['new key' => 'messages']],
6767
['{{ 1 ? "new key" | trans : "another key" | trans }}', ['new key' => 'messages', 'another key' => 'messages']],
6868
['{{ t("new key") | trans() }}', ['new key' => 'messages']],
69+
['{% set foo = t("new key") %}', ['new key' => 'messages']],
6970
['{{ t("new key", {}, "domain") | trans() }}', ['new key' => 'domain']],
7071
['{{ 1 ? t("new key") | trans : t("another key") | trans }}', ['new key' => 'messages', 'another key' => 'messages']],
7172

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.