You are here

private function Translator::initializeCacheCatalogue in Plug 7

Parameters

string $locale:

1 call to Translator::initializeCacheCatalogue()
Translator::loadCatalogue in lib/Symfony/translation/Translator.php

File

lib/Symfony/translation/Translator.php, line 340

Class

Translator
Translator.

Namespace

Symfony\Component\Translation

Code

private function initializeCacheCatalogue($locale) {
  if (isset($this->catalogues[$locale])) {

    /* Catalogue already initialized. */
    return;
  }
  $this
    ->assertValidLocale($locale);
  $self = $this;

  // required for PHP 5.3 where "$this" cannot be use()d in anonymous functions. Change in Symfony 3.0.
  $cache = $this
    ->getConfigCacheFactory()
    ->cache($this
    ->getCatalogueCachePath($locale), function (ConfigCacheInterface $cache) use ($self, $locale) {
    $self
      ->dumpCatalogue($locale, $cache);
  });
  if (isset($this->catalogues[$locale])) {

    /* Catalogue has been initialized as it was written out to cache. */
    return;
  }

  /* Read catalogue from cache. */
  $this->catalogues[$locale] = (include $cache
    ->getPath());
}