I18nExtension.php 880 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. namespace PhpMyAdmin\Twig;
  9. use PhpMyAdmin\Twig\I18n\TokenParserTrans;
  10. use Twig\Extensions\I18nExtension as TwigI18nExtension;
  11. use Twig\TwigFilter;
  12. /**
  13. * Class I18nExtension
  14. *
  15. * @package PhpMyAdmin\Twig
  16. */
  17. class I18nExtension extends TwigI18nExtension
  18. {
  19. /**
  20. * Returns the token parser instances to add to the existing list.
  21. *
  22. * @return \Twig\TokenParser\TokenParserInterface[]
  23. */
  24. public function getTokenParsers()
  25. {
  26. return array(new TokenParserTrans());
  27. }
  28. /**
  29. * Returns a list of filters to add to the existing list.
  30. *
  31. * @return TwigFilter[]
  32. */
  33. public function getFilters()
  34. {
  35. return array(
  36. new TwigFilter('trans', '_gettext'),
  37. );
  38. }
  39. }