private function Translator::getFallbackContent in Plug 7
1 call to Translator::getFallbackContent()
- Translator::dumpCatalogue in lib/
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
- lib/
Symfony/ translation/ Translator.php, line 394
Class
- Translator
- Translator.
Namespace
Symfony\Component\TranslationCode
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;
}