public function MessageCatalogue::addFallbackCatalogue in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/translation/MessageCatalogue.php \Symfony\Component\Translation\MessageCatalogue::addFallbackCatalogue()
Merges translations from the given Catalogue into the current one only when the translation does not exist.
This is used to provide default translations when they do not exist for the current locale.
Parameters
MessageCatalogueInterface $catalogue A MessageCatalogueInterface instance:
Overrides MessageCatalogueInterface::addFallbackCatalogue
File
- vendor/
symfony/ translation/ MessageCatalogue.php, line 166
Class
- MessageCatalogue
- MessageCatalogue.
Namespace
Symfony\Component\TranslationCode
public function addFallbackCatalogue(MessageCatalogueInterface $catalogue) {
// detect circular references
$c = $catalogue;
while ($c = $c
->getFallbackCatalogue()) {
if ($c
->getLocale() === $this
->getLocale()) {
throw new \LogicException(sprintf('Circular reference detected when adding a fallback catalogue for locale "%s".', $catalogue
->getLocale()));
}
}
$c = $this;
do {
if ($c
->getLocale() === $catalogue
->getLocale()) {
throw new \LogicException(sprintf('Circular reference detected when adding a fallback catalogue for locale "%s".', $catalogue
->getLocale()));
}
} while ($c = $c->parent);
$catalogue->parent = $this;
$this->fallbackCatalogue = $catalogue;
foreach ($catalogue
->getResources() as $resource) {
$this
->addResource($resource);
}
}