4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Translation\Extractor;
14 use Symfony\Component\Translation\MessageCatalogue;
17 * ChainExtractor extracts translation messages from template files.
19 * @author Michel Salib <michelsalib@hotmail.com>
21 class ChainExtractor implements ExtractorInterface
26 * @var ExtractorInterface[]
28 private $extractors = array();
31 * Adds a loader to the translation extractor.
33 * @param string $format The format of the loader
34 * @param ExtractorInterface $extractor The loader
36 public function addExtractor($format, ExtractorInterface $extractor)
38 $this->extractors[$format] = $extractor;
44 public function setPrefix($prefix)
46 foreach ($this->extractors as $extractor) {
47 $extractor->setPrefix($prefix);
54 public function extract($directory, MessageCatalogue $catalogue)
56 foreach ($this->extractors as $extractor) {
57 $extractor->extract($directory, $catalogue);