diff --git a/core/modules/dynamic_page_cache/tests/dynamic_page_cache_test/src/DynamicPageCacheTestController.php b/core/modules/dynamic_page_cache/tests/dynamic_page_cache_test/src/DynamicPageCacheTestController.php index 9989276..b11984e 100644 --- a/core/modules/dynamic_page_cache/tests/dynamic_page_cache_test/src/DynamicPageCacheTestController.php +++ b/core/modules/dynamic_page_cache/tests/dynamic_page_cache_test/src/DynamicPageCacheTestController.php @@ -9,6 +9,7 @@ use Drupal\Component\Utility\SafeMarkup; use Drupal\Core\Cache\CacheableResponse; +use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\user\Entity\User; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -18,6 +19,8 @@ */ class DynamicPageCacheTestController { + use StringTranslationTrait; + /** * A route returning a Response object. * @@ -69,7 +72,7 @@ public function html() { public function htmlWithCacheContexts(Request $request) { $build = $this->html(); $build['dynamic_part'] = [ - '#markup' => SafeMarkup::format('Hello there, %animal.', ['%animal' => $request->query->get('animal')]), + '#markup' => $this->t('Hello there, %animal.', ['%animal' => $request->query->get('animal')]), '#cache' => [ 'contexts' => [ 'url.query_args:animal', @@ -109,7 +112,7 @@ public function htmlUncacheableMaxAge() { public function htmlUncacheableContexts() { $build = $this->html(); $build['very_dynamic_part'] = [ - '#markup' => t('@username cannot handle the awesomeness of llamas.', ['@username' => \Drupal::currentUser()->getDisplayName()]), + '#markup' => $this->t('@username cannot handle the awesomeness of llamas.', ['@username' => \Drupal::currentUser()->getDisplayName()]), '#cache' => [ 'contexts' => [ 'user',