YamlFileDumper.php 822 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Translation\Dumper;
  11. use Symfony\Component\Translation\MessageCatalogue;
  12. use Symfony\Component\Yaml\Yaml;
  13. /**
  14. * YamlFileDumper generates yaml files from a message catalogue.
  15. *
  16. * @author Michel Salib <michelsalib@hotmail.com>
  17. */
  18. class YamlFileDumper extends FileDumper
  19. {
  20. /**
  21. * {@inheritDoc}
  22. */
  23. protected function format(MessageCatalogue $messages, $domain)
  24. {
  25. return Yaml::dump($messages->all($domain));
  26. }
  27. /**
  28. * {@inheritDoc}
  29. */
  30. protected function getExtension()
  31. {
  32. return 'yml';
  33. }
  34. }