public function rebuildCache($locale)
{
$cache = new ConfigCache($this->options['cache_dir'] . '/catalogue.' . $locale . '.php', $this->options['debug']);
$this->initialize();
// one of the rare situations to "skip" to the grandparent implementation.
\Symfony\Component\Translation\Translator::loadCatalogue($locale);
$fallbackContent = '';
$current = '';
foreach ($this->computeFallbackLocales($locale) as $fallback) {
$fallbackSuffix = ucfirst(str_replace('-', '_', $fallback));
$fallbackContent .= sprintf(<<<EOF
\$catalogue%s = new MessageCatalogue('%s', %s);
\$catalogue%s->addFallbackCatalogue(\$catalogue%s);
EOF
, $fallbackSuffix, $fallback, var_export($this->catalogues[$fallback]->all(), true), ucfirst(str_replace('-', '_', $current)), $fallbackSuffix);
$current = $fallback;
}
$content = sprintf(<<<EOF
<?php
use Symfony\\Component\\Translation\\MessageCatalogue;
\$catalogue = new MessageCatalogue('%s', %s);
%s
return \$catalogue;
EOF
, $locale, var_export($this->catalogues[$locale]->all(), true), $fallbackContent);
$cache->write($content, $this->catalogues[$locale]->getResources());
}