I18nExtension.php 745 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. declare(strict_types=1);
  3. namespace PhpMyAdmin\Twig;
  4. use PhpMyAdmin\Twig\Extensions\I18nExtension as TwigI18nExtension;
  5. use PhpMyAdmin\Twig\I18n\TokenParserTrans;
  6. use Twig\TokenParser\TokenParserInterface;
  7. use Twig\TwigFilter;
  8. class I18nExtension extends TwigI18nExtension
  9. {
  10. /**
  11. * Returns the token parser instances to add to the existing list.
  12. *
  13. * @return TokenParserInterface[]
  14. */
  15. public function getTokenParsers()
  16. {
  17. return [new TokenParserTrans()];
  18. }
  19. /**
  20. * Returns a list of filters to add to the existing list.
  21. *
  22. * @return TwigFilter[]
  23. */
  24. public function getFilters()
  25. {
  26. return [
  27. new TwigFilter('trans', '_gettext'),
  28. ];
  29. }
  30. }