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 8e654e8

Browse filesBrowse files
committed
[TwigBundle] added the trans filter
1 parent 68bff2d commit 8e654e8
Copy full SHA for 8e654e8

File tree

Expand file treeCollapse file tree

1 file changed

+15
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+15
-0
lines changed

‎src/Symfony/Bundle/TwigBundle/Extension/TransExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/TwigBundle/Extension/TransExtension.php
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@ public function getTranslator()
3333
return $this->translator;
3434
}
3535

36+
/**
37+
* {@inheritdoc}
38+
*/
39+
public function getFilters()
40+
{
41+
return array(
42+
'trans' => new \Twig_Filter_Method($this, 'trans'),
43+
);
44+
}
45+
3646
/**
3747
* Returns the token parser instance to add to the existing list.
3848
*
@@ -51,6 +61,11 @@ public function getTokenParsers()
5161
);
5262
}
5363

64+
public function trans($message, array $arguments = array(), $domain = "messages")
65+
{
66+
return $this->translator->trans($message, $arguments, $domain);
67+
}
68+
5469
/**
5570
* Returns the name of the extension.
5671
*

0 commit comments

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