function LocaleTranslationCacheTag::saveTranslation

Same name and namespace in other branches
  1. 10 core/modules/locale/src/EventSubscriber/LocaleTranslationCacheTag.php \Drupal\locale\EventSubscriber\LocaleTranslationCacheTag::saveTranslation()
  2. 9 core/modules/locale/src/EventSubscriber/LocaleTranslationCacheTag.php \Drupal\locale\EventSubscriber\LocaleTranslationCacheTag::saveTranslation()
  3. 8.9.x core/modules/locale/src/EventSubscriber/LocaleTranslationCacheTag.php \Drupal\locale\EventSubscriber\LocaleTranslationCacheTag::saveTranslation()
  4. main core/modules/locale/src/EventSubscriber/LocaleTranslationCacheTag.php \Drupal\locale\EventSubscriber\LocaleTranslationCacheTag::saveTranslation()

Invalidate cache tags whenever a string is translated.

File

core/modules/locale/src/EventSubscriber/LocaleTranslationCacheTag.php, line 34

Class

LocaleTranslationCacheTag
A subscriber invalidating cache tags when translating a string.

Namespace

Drupal\locale\EventSubscriber

Code

public function saveTranslation() {
  $this->cacheTagsInvalidator
    ->invalidateTags([
    'rendered',
    'locale',
    'library_info',
  ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.