LocaleTranslationCacheTag.php in Drupal 8
File
core/modules/locale/src/EventSubscriber/LocaleTranslationCacheTag.php
View source
<?php
namespace Drupal\locale\EventSubscriber;
use Drupal\Core\Cache\CacheTagsInvalidatorInterface;
use Drupal\locale\LocaleEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class LocaleTranslationCacheTag implements EventSubscriberInterface {
protected $cacheTagsInvalidator;
public function __construct(CacheTagsInvalidatorInterface $cache_tags_invalidator) {
$this->cacheTagsInvalidator = $cache_tags_invalidator;
}
public function saveTranslation() {
$this->cacheTagsInvalidator
->invalidateTags([
'rendered',
'locale',
'library_info',
]);
}
public static function getSubscribedEvents() {
$events[LocaleEvents::SAVE_TRANSLATION][] = [
'saveTranslation',
];
return $events;
}
}