diff --git a/flextype/twig/I18nTwigExtension.php b/flextype/twig/I18nTwigExtension.php index 02004365..af37c15e 100644 --- a/flextype/twig/I18nTwigExtension.php +++ b/flextype/twig/I18nTwigExtension.php @@ -12,6 +12,7 @@ namespace Flextype; use Flextype\Component\I18n\I18n; use Twig_Extension; use Twig_SimpleFunction; +use Twig_SimpleFilter; class I18nTwigExtension extends Twig_Extension { @@ -27,6 +28,18 @@ class I18nTwigExtension extends Twig_Extension ]; } + /** + * Returns a list of filters to add to the existing list. + * + * @return array + */ + public function getFilters() : array + { + return [ + new Twig_SimpleFilter('tr', [$this, 'tr']), + ]; + } + /** * Translate string */