I18n.php 1018B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /*
  3. * This file is part of Twig.
  4. *
  5. * (c) 2010 Fabien Potencier
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. class Twig_Extensions_Extension_I18n extends Twig_Extension
  11. {
  12. /**
  13. * Returns the token parser instances to add to the existing list.
  14. *
  15. * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances
  16. */
  17. public function getTokenParsers()
  18. {
  19. return array(new Twig_Extensions_TokenParser_Trans());
  20. }
  21. /**
  22. * Returns a list of filters to add to the existing list.
  23. *
  24. * @return array An array of filters
  25. */
  26. public function getFilters()
  27. {
  28. return array(
  29. 'trans' => new Twig_Filter_Function('gettext'),
  30. );
  31. }
  32. /**
  33. * Returns the name of the extension.
  34. *
  35. * @return string The extension name
  36. */
  37. public function getName()
  38. {
  39. return 'i18n';
  40. }
  41. }