firefly-iii/app/Support/Twig/Translation.php

44 lines
662 B
PHP
Raw Normal View History

2015-05-09 15:42:45 -05:00
<?php
namespace FireflyIII\Support\Twig;
use Twig_Extension;
use Twig_SimpleFilter;
/**
2015-06-29 02:23:39 -05:00
* @codeCoverageIgnore
2015-06-29 02:53:10 -05:00
*
2015-05-09 15:42:45 -05:00
* Class Budget
*
* @package FireflyIII\Support\Twig
*/
class Translation extends Twig_Extension
{
/**
* @return array
*/
public function getFilters()
{
$filters = [];
$filters[] = new Twig_SimpleFilter(
2015-06-06 16:09:12 -05:00
'_', function ($name) {
2015-05-09 15:42:45 -05:00
2015-05-14 02:51:54 -05:00
return trans('firefly.' . $name);
2015-05-09 15:42:45 -05:00
}, ['is_safe' => ['html']]
);
return $filters;
}
/**
* {@inheritDoc}
*/
public function getName()
{
return 'FireflyIII\Support\Twig\Translation';
}
}