2015-05-09 15:42:45 -05:00
|
|
|
<?php
|
2016-05-20 05:41:23 -05:00
|
|
|
/**
|
|
|
|
* Translation.php
|
|
|
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
|
|
|
*
|
|
|
|
* This software may be modified and distributed under the terms
|
|
|
|
* of the MIT license. See the LICENSE file for details.
|
|
|
|
*/
|
|
|
|
|
2016-02-05 05:08:25 -06:00
|
|
|
declare(strict_types = 1);
|
2015-05-09 15:42:45 -05:00
|
|
|
|
|
|
|
namespace FireflyIII\Support\Twig;
|
|
|
|
|
|
|
|
use Twig_Extension;
|
|
|
|
use Twig_SimpleFilter;
|
|
|
|
|
|
|
|
/**
|
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
|
|
|
|
*/
|
2016-04-05 15:00:03 -05:00
|
|
|
public function getFilters(): array
|
2015-05-09 15:42:45 -05:00
|
|
|
{
|
|
|
|
$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}
|
|
|
|
*/
|
2016-04-05 15:00:03 -05:00
|
|
|
public function getName(): string
|
2015-05-09 15:42:45 -05:00
|
|
|
{
|
|
|
|
return 'FireflyIII\Support\Twig\Translation';
|
|
|
|
}
|
|
|
|
}
|