public function LocaleLookup::__construct

Constructs a LocaleCache object.

Overrides CacheArray::__construct

File

drupal/core/modules/locale/lib/Drupal/locale/LocaleLookup.php, line 41
Definition of LocaleLookup

Class

LocaleLookup
Extends CacheArray to allow for dynamic building of the locale cache.

Namespace

Drupal\locale

Code

public function __construct($langcode, $context, $stringStorage) {
  $this->langcode = $langcode;
  $this->context = (string) $context;
  $this->stringStorage = $stringStorage;

  // Add the current user's role IDs to the cache key, this ensures that, for
  // example, strings for admin menu items and settings forms are not cached
  // for anonymous users.
  $rids = implode(':', array_keys($GLOBALS['user']->roles));
  parent::__construct("locale:{$langcode}:{$context}:{$rids}", 'cache', array(
    'locale' => TRUE,
  ));
}