I18nExtension.php 931 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * hold PhpMyAdmin\Twig\I18nExtension class
  5. *
  6. * @package PhpMyAdmin\Twig
  7. */
  8. declare(strict_types=1);
  9. namespace PhpMyAdmin\Twig;
  10. use PhpMyAdmin\Twig\Extensions\I18nExtension as TwigI18nExtension;
  11. use PhpMyAdmin\Twig\I18n\TokenParserTrans;
  12. use Twig\TokenParser\TokenParserInterface;
  13. use Twig\TwigFilter;
  14. /**
  15. * Class I18nExtension
  16. *
  17. * @package PhpMyAdmin\Twig
  18. */
  19. class I18nExtension extends TwigI18nExtension
  20. {
  21. /**
  22. * Returns the token parser instances to add to the existing list.
  23. *
  24. * @return TokenParserInterface[]
  25. */
  26. public function getTokenParsers()
  27. {
  28. return [new TokenParserTrans()];
  29. }
  30. /**
  31. * Returns a list of filters to add to the existing list.
  32. *
  33. * @return TwigFilter[]
  34. */
  35. public function getFilters()
  36. {
  37. return [
  38. new TwigFilter('trans', '_gettext'),
  39. ];
  40. }
  41. }