You are here

public function MessageCatalogue::addCatalogue in Plug 7

@api

Overrides MessageCatalogueInterface::addCatalogue

File

lib/Symfony/translation/MessageCatalogue.php, line 165

Class

MessageCatalogue
MessageCatalogue.

Namespace

Symfony\Component\Translation

Code

public function addCatalogue(MessageCatalogueInterface $catalogue) {
  if ($catalogue
    ->getLocale() !== $this->locale) {
    throw new \LogicException(sprintf('Cannot add a catalogue for locale "%s" as the current locale for this catalogue is "%s"', $catalogue
      ->getLocale(), $this->locale));
  }
  foreach ($catalogue
    ->all() as $domain => $messages) {
    $this
      ->add($messages, $domain);
  }
  foreach ($catalogue
    ->getResources() as $resource) {
    $this
      ->addResource($resource);
  }
  if ($catalogue instanceof MetadataAwareInterface) {
    $metadata = $catalogue
      ->getMetadata('', '');
    $this
      ->addMetadata($metadata);
  }
}