[TWIG][I18N] Add transList function, which uses _m_list

This commit is contained in:
Hugo Sales 2022-03-01 13:11:53 +00:00
parent f73e9c12ba
commit 070f53c10e
No known key found for this signature in database
GPG Key ID: 7D0C7EAFC9D835A0
2 changed files with 7 additions and 0 deletions

View File

@ -80,6 +80,7 @@ class Extension extends AbstractExtension
new TwigFunction('show_stylesheets', [Runtime::class, 'getShowStylesheets']),
new TwigFunction('add_right_panel_block', [Runtime::class, 'addRightPanelBlock']),
new TwigFunction('trans', [Runtime::class, 'trans']),
new TwigFunction('trans_list', [Runtime::class, 'transList']),
];
}
}

View File

@ -34,6 +34,7 @@ namespace App\Twig;
use App\Core\Event;
use function App\Core\I18n\_m;
use function App\Core\I18n\_m_list;
use App\Core\Router\Router;
use App\Entity\Actor;
use App\Entity\Feed;
@ -62,6 +63,11 @@ class Runtime implements RuntimeExtensionInterface, EventSubscriberInterface
return _m($message, $arguments);
}
public function transList(array $elements): string
{
return _m_list($elements);
}
public function isCurrentRouteActive(string ...$routes): string
{
return $this->isCurrentRoute('active', ...$routes);