You are here

private function Translator::initializeCacheCatalogue in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/translation/Translator.php \Symfony\Component\Translation\Translator::initializeCacheCatalogue()

Parameters

string $locale:

1 call to Translator::initializeCacheCatalogue()
Translator::loadCatalogue in vendor/symfony/translation/Translator.php

File

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

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());
}