mirror of
https://github.com/shlinkio/shlink.git
synced 2026-02-28 12:13:13 +08:00
25 lines
593 B
PHP
25 lines
593 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace Shlinkio\Shlink\Common\Template\Extension;
|
|
|
|
use League\Plates\Engine;
|
|
use League\Plates\Extension\ExtensionInterface;
|
|
use Zend\I18n\Translator\TranslatorInterface;
|
|
|
|
class TranslatorExtension implements ExtensionInterface
|
|
{
|
|
/** @var TranslatorInterface */
|
|
private $translator;
|
|
|
|
public function __construct(TranslatorInterface $translator)
|
|
{
|
|
$this->translator = $translator;
|
|
}
|
|
|
|
public function register(Engine $engine): void
|
|
{
|
|
$engine->registerFunction('translate', [$this->translator, 'translate']);
|
|
}
|
|
}
|