You are here

private function Translator::getFallbackContent in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/translation/Translator.php \Symfony\Component\Translation\Translator::getFallbackContent()
1 call to Translator::getFallbackContent()
Translator::dumpCatalogue in vendor/symfony/translation/Translator.php
This method is public because it needs to be callable from a closure in PHP 5.3. It should be made protected (or even private, if possible) in 3.0.

File

vendor/symfony/translation/Translator.php, line 368

Class

Translator
Translator.

Namespace

Symfony\Component\Translation

Code

private function getFallbackContent(MessageCatalogue $catalogue) {
  $fallbackContent = '';
  $current = '';
  $replacementPattern = '/[^a-z0-9_]/i';
  $fallbackCatalogue = $catalogue
    ->getFallbackCatalogue();
  while ($fallbackCatalogue) {
    $fallback = $fallbackCatalogue
      ->getLocale();
    $fallbackSuffix = ucfirst(preg_replace($replacementPattern, '_', $fallback));
    $currentSuffix = ucfirst(preg_replace($replacementPattern, '_', $current));
    $fallbackContent .= sprintf(<<<EOF
\$catalogue%s = new MessageCatalogue('%s', %s);
\$catalogue%s->addFallbackCatalogue(\$catalogue%s);

EOF
, $fallbackSuffix, $fallback, var_export($fallbackCatalogue
      ->all(), true), $currentSuffix, $fallbackSuffix);
    $current = $fallbackCatalogue
      ->getLocale();
    $fallbackCatalogue = $fallbackCatalogue
      ->getFallbackCatalogue();
  }
  return $fallbackContent;
}