diff --git a/core/modules/comment/src/CommentForm.php b/core/modules/comment/src/CommentForm.php
index 48c7271..b9b921b 100644
--- a/core/modules/comment/src/CommentForm.php
+++ b/core/modules/comment/src/CommentForm.php
@@ -381,7 +381,7 @@ public function save(array $form, FormStateInterface $form_state) {
       // Add a log entry.
       $logger->notice('Comment posted: %subject.', [
           '%subject' => $comment->getSubject(),
-          'link' => Link::fromTextAndUrl(t('View'), $comment->toUrl()->setOption('fragment', 'comment-' . $comment->id()))->toString(),
+          'link' => Link::fromTextAndUrl($this->t('View'), $comment->toUrl()->setOption('fragment', 'comment-' . $comment->id()))->toString(),
         ]);
 
       // Explain the approval queue if necessary.
diff --git a/core/modules/comment/src/CommentLazyBuilders.php b/core/modules/comment/src/CommentLazyBuilders.php
index 90c2c69..95f1356 100644
--- a/core/modules/comment/src/CommentLazyBuilders.php
+++ b/core/modules/comment/src/CommentLazyBuilders.php
@@ -170,20 +170,20 @@ protected function buildLinks(CommentInterface $entity, EntityInterface $comment
     if ($status == CommentItemInterface::OPEN) {
       if ($entity->access('delete')) {
         $links['comment-delete'] = [
-          'title' => t('Delete'),
+          'title' => $this->t('Delete'),
           'url' => $entity->toUrl('delete-form'),
         ];
       }
 
       if ($entity->access('update')) {
         $links['comment-edit'] = [
-          'title' => t('Edit'),
+          'title' => $this->t('Edit'),
           'url' => $entity->toUrl('edit-form'),
         ];
       }
       if ($entity->access('create')) {
         $links['comment-reply'] = [
-          'title' => t('Reply'),
+          'title' => $this->t('Reply'),
           'url' => Url::fromRoute('comment.reply', [
             'entity_type' => $entity->getCommentedEntityTypeId(),
             'entity' => $entity->getCommentedEntityId(),
@@ -194,7 +194,7 @@ protected function buildLinks(CommentInterface $entity, EntityInterface $comment
       }
       if (!$entity->isPublished() && $entity->access('approve')) {
         $links['comment-approve'] = [
-          'title' => t('Approve'),
+          'title' => $this->t('Approve'),
           'url' => Url::fromRoute('comment.approve', ['comment' => $entity->id()]),
         ];
       }
@@ -206,7 +206,7 @@ protected function buildLinks(CommentInterface $entity, EntityInterface $comment
     // Add translations link for translation-enabled comment bundles.
     if ($this->moduleHandler->moduleExists('content_translation') && $this->access($entity)->isAllowed()) {
       $links['comment-translations'] = [
-        'title' => t('Translate'),
+        'title' => $this->t('Translate'),
         'url' => $entity->toUrl('drupal:content-translation-overview'),
       ];
     }
diff --git a/core/modules/comment/src/CommentStatistics.php b/core/modules/comment/src/CommentStatistics.php
index 95d8a12..5d1d8e7 100644
--- a/core/modules/comment/src/CommentStatistics.php
+++ b/core/modules/comment/src/CommentStatistics.php
@@ -163,7 +163,7 @@ public function getMaximumCount($entity_type) {
   public function getRankingInfo() {
     return [
       'comments' => [
-        'title' => t('Number of comments'),
+        'title' => $this->t('Number of comments'),
         'join' => [
           'type' => 'LEFT',
           'table' => 'comment_entity_statistics',
@@ -179,7 +179,7 @@ public function getRankingInfo() {
         // values in as strings instead of numbers in complex expressions like
         // this.
         'score' => '2.0 - 2.0 / (1.0 + ces.comment_count * (ROUND(:comment_scale, 4)))',
-        'arguments' => [':comment_scale' => \Drupal::state()->get('comment.node_comment_statistics_scale') ?: 0],
+        'arguments' => [':comment_scale' => $this->state->get('comment.node_comment_statistics_scale') ?: 0],
       ],
     ];
   }
diff --git a/core/modules/comment/src/CommentStorage.php b/core/modules/comment/src/CommentStorage.php
index 7a4d69e..9a4aa6c 100644
--- a/core/modules/comment/src/CommentStorage.php
+++ b/core/modules/comment/src/CommentStorage.php
@@ -158,7 +158,6 @@ public function getNewCommentPageNumber($total_comments, $new_comments, Fieldabl
     }
     else {
       // Threaded comments.
-
       // 1. Find all the threads with a new comment.
       $unread_threads_query = $this->database->select($data_table, 'comment')
         ->fields('comment', ['thread'])
diff --git a/core/modules/comment/src/CommentTranslationHandler.php b/core/modules/comment/src/CommentTranslationHandler.php
index a0abe4b..433d057 100644
--- a/core/modules/comment/src/CommentTranslationHandler.php
+++ b/core/modules/comment/src/CommentTranslationHandler.php
@@ -30,7 +30,7 @@ public function entityFormAlter(array &$form, FormStateInterface $form_state, En
    * {@inheritdoc}
    */
   protected function entityFormTitle(EntityInterface $entity) {
-    return t('Edit comment @subject', ['@subject' => $entity->label()]);
+    return $this->t('Edit comment @subject', ['@subject' => $entity->label()]);
   }
 
   /**
diff --git a/core/modules/comment/src/CommentTypeForm.php b/core/modules/comment/src/CommentTypeForm.php
index ff7be1c..794435c 100644
--- a/core/modules/comment/src/CommentTypeForm.php
+++ b/core/modules/comment/src/CommentTypeForm.php
@@ -75,7 +75,7 @@ public function form(array $form, FormStateInterface $form_state) {
 
     $form['label'] = [
       '#type' => 'textfield',
-      '#title' => t('Label'),
+      '#title' => $this->t('Label'),
       '#maxlength' => 255,
       '#default_value' => $comment_type->label(),
       '#required' => TRUE,
@@ -93,8 +93,8 @@ public function form(array $form, FormStateInterface $form_state) {
     $form['description'] = [
       '#type' => 'textarea',
       '#default_value' => $comment_type->getDescription(),
-      '#description' => t('Describe this comment type. The text will be displayed on the <em>Comment types</em> administration overview page.'),
-      '#title' => t('Description'),
+      '#description' => $this->t('Describe this comment type. The text will be displayed on the <em>Comment types</em> administration overview page.'),
+      '#title' => $this->t('Description'),
     ];
 
     if ($comment_type->isNew()) {
@@ -109,23 +109,23 @@ public function form(array $form, FormStateInterface $form_state) {
       $form['target_entity_type_id'] = [
         '#type' => 'select',
         '#default_value' => $comment_type->getTargetEntityTypeId(),
-        '#title' => t('Target entity type'),
+        '#title' => $this->t('Target entity type'),
         '#options' => $options,
-        '#description' => t('The target entity type can not be changed after the comment type has been created.'),
+        '#description' => $this->t('The target entity type can not be changed after the comment type has been created.'),
       ];
     }
     else {
       $form['target_entity_type_id_display'] = [
         '#type' => 'item',
         '#markup' => $this->entityTypeManager->getDefinition($comment_type->getTargetEntityTypeId())->getLabel(),
-        '#title' => t('Target entity type'),
+        '#title' => $this->t('Target entity type'),
       ];
     }
 
     if ($this->moduleHandler->moduleExists('content_translation')) {
       $form['language'] = [
         '#type' => 'details',
-        '#title' => t('Language settings'),
+        '#title' => $this->t('Language settings'),
         '#group' => 'additional_settings',
       ];
 
@@ -145,7 +145,7 @@ public function form(array $form, FormStateInterface $form_state) {
     $form['actions'] = ['#type' => 'actions'];
     $form['actions']['submit'] = [
       '#type' => 'submit',
-      '#value' => t('Save'),
+      '#value' => $this->t('Save'),
     ];
 
     return $form;
@@ -160,12 +160,12 @@ public function save(array $form, FormStateInterface $form_state) {
 
     $edit_link = $this->entity->toLink($this->t('Edit'), 'edit-form')->toString();
     if ($status == SAVED_UPDATED) {
-      $this->messenger()->addStatus(t('Comment type %label has been updated.', ['%label' => $comment_type->label()]));
+      $this->messenger()->addStatus($this->t('Comment type %label has been updated.', ['%label' => $comment_type->label()]));
       $this->logger->notice('Comment type %label has been updated.', ['%label' => $comment_type->label(), 'link' => $edit_link]);
     }
     else {
       $this->commentManager->addBodyField($comment_type->id());
-      $this->messenger()->addStatus(t('Comment type %label has been added.', ['%label' => $comment_type->label()]));
+      $this->messenger()->addStatus($this->t('Comment type %label has been added.', ['%label' => $comment_type->label()]));
       $this->logger->notice('Comment type %label has been added.', ['%label' => $comment_type->label(), 'link' => $edit_link]);
     }
 
diff --git a/core/modules/comment/src/CommentTypeListBuilder.php b/core/modules/comment/src/CommentTypeListBuilder.php
index 53bf4c9..ffc367a 100644
--- a/core/modules/comment/src/CommentTypeListBuilder.php
+++ b/core/modules/comment/src/CommentTypeListBuilder.php
@@ -29,8 +29,8 @@ public function getDefaultOperations(EntityInterface $entity) {
    * {@inheritdoc}
    */
   public function buildHeader() {
-    $header['type'] = t('Comment type');
-    $header['description'] = t('Description');
+    $header['type'] = $this->t('Comment type');
+    $header['description'] = $this->t('Description');
     return $header + parent::buildHeader();
   }
 
diff --git a/core/modules/comment/src/Entity/Comment.php b/core/modules/comment/src/Entity/Comment.php
index 7cbf74b..5679c93 100644
--- a/core/modules/comment/src/Entity/Comment.php
+++ b/core/modules/comment/src/Entity/Comment.php
@@ -111,7 +111,6 @@ public function preSave(EntityStorageInterface $storage) {
         else {
           // This is a comment with a parent comment, so increase the part of
           // the thread value at the proper depth.
-
           // Get the parent comment:
           $parent = $this->getParentComment();
           // Strip the "/" from the end of the parent thread.
@@ -227,31 +226,31 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
     $fields += static::publishedBaseFieldDefinitions($entity_type);
     $fields += static::ownerBaseFieldDefinitions($entity_type);
 
-    $fields['cid']->setLabel(t('Comment ID'))
-      ->setDescription(t('The comment ID.'));
+    $fields['cid']->setLabel($this->t('Comment ID'))
+      ->setDescription($this->t('The comment ID.'));
 
-    $fields['uuid']->setDescription(t('The comment UUID.'));
+    $fields['uuid']->setDescription($this->t('The comment UUID.'));
 
-    $fields['comment_type']->setLabel(t('Comment Type'))
-      ->setDescription(t('The comment type.'));
+    $fields['comment_type']->setLabel($this->t('Comment Type'))
+      ->setDescription($this->t('The comment type.'));
 
-    $fields['langcode']->setDescription(t('The comment language code.'));
+    $fields['langcode']->setDescription($this->t('The comment language code.'));
 
     // Set the default value callback for the status field.
     $fields['status']->setDefaultValueCallback('Drupal\comment\Entity\Comment::getDefaultStatus');
 
     $fields['pid'] = BaseFieldDefinition::create('entity_reference')
-      ->setLabel(t('Parent ID'))
-      ->setDescription(t('The parent comment ID if this is a reply to a comment.'))
+      ->setLabel($this->t('Parent ID'))
+      ->setDescription($this->t('The parent comment ID if this is a reply to a comment.'))
       ->setSetting('target_type', 'comment');
 
     $fields['entity_id'] = BaseFieldDefinition::create('entity_reference')
-      ->setLabel(t('Entity ID'))
-      ->setDescription(t('The ID of the entity of which this comment is a reply.'))
+      ->setLabel($this->t('Entity ID'))
+      ->setDescription($this->t('The ID of the entity of which this comment is a reply.'))
       ->setRequired(TRUE);
 
     $fields['subject'] = BaseFieldDefinition::create('string')
-      ->setLabel(t('Subject'))
+      ->setLabel($this->t('Subject'))
       ->setTranslatable(TRUE)
       ->setSetting('max_length', 64)
       ->setDisplayOptions('form', [
@@ -262,61 +261,61 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
       ->setDisplayConfigurable('form', TRUE);
 
     $fields['uid']
-      ->setDescription(t('The user ID of the comment author.'));
+      ->setDescription($this->t('The user ID of the comment author.'));
 
     $fields['name'] = BaseFieldDefinition::create('string')
-      ->setLabel(t('Name'))
-      ->setDescription(t("The comment author's name."))
+      ->setLabel($this->t('Name'))
+      ->setDescription($this->t("The comment author's name."))
       ->setTranslatable(TRUE)
       ->setSetting('max_length', 60)
       ->setDefaultValue('');
 
     $fields['mail'] = BaseFieldDefinition::create('email')
-      ->setLabel(t('Email'))
-      ->setDescription(t("The comment author's email address."))
+      ->setLabel($this->t('Email'))
+      ->setDescription($this->t("The comment author's email address."))
       ->setTranslatable(TRUE);
 
     $fields['homepage'] = BaseFieldDefinition::create('uri')
-      ->setLabel(t('Homepage'))
-      ->setDescription(t("The comment author's home page address."))
+      ->setLabel($this->t('Homepage'))
+      ->setDescription($this->t("The comment author's home page address."))
       ->setTranslatable(TRUE)
       // URIs are not length limited by RFC 2616, but we can only store 255
       // characters in our comment DB schema.
       ->setSetting('max_length', 255);
 
     $fields['hostname'] = BaseFieldDefinition::create('string')
-      ->setLabel(t('Hostname'))
-      ->setDescription(t("The comment author's hostname."))
+      ->setLabel($this->t('Hostname'))
+      ->setDescription($this->t("The comment author's hostname."))
       ->setTranslatable(TRUE)
       ->setSetting('max_length', 128)
       ->setDefaultValueCallback(static::class . '::getDefaultHostname');
 
     $fields['created'] = BaseFieldDefinition::create('created')
-      ->setLabel(t('Created'))
-      ->setDescription(t('The time that the comment was created.'))
+      ->setLabel($this->t('Created'))
+      ->setDescription($this->t('The time that the comment was created.'))
       ->setTranslatable(TRUE);
 
     $fields['changed'] = BaseFieldDefinition::create('changed')
-      ->setLabel(t('Changed'))
-      ->setDescription(t('The time that the comment was last edited.'))
+      ->setLabel($this->t('Changed'))
+      ->setDescription($this->t('The time that the comment was last edited.'))
       ->setTranslatable(TRUE);
 
     $fields['thread'] = BaseFieldDefinition::create('string')
-      ->setLabel(t('Thread place'))
-      ->setDescription(t("The alphadecimal representation of the comment's place in a thread, consisting of a base 36 string prefixed by an integer indicating its length."))
+      ->setLabel($this->t('Thread place'))
+      ->setDescription($this->t("The alphadecimal representation of the comment's place in a thread, consisting of a base 36 string prefixed by an integer indicating its length."))
       ->setSetting('max_length', 255);
 
     $fields['entity_type'] = BaseFieldDefinition::create('string')
-      ->setLabel(t('Entity type'))
+      ->setLabel($this->t('Entity type'))
       ->setRequired(TRUE)
-      ->setDescription(t('The entity type to which this comment is attached.'))
+      ->setDescription($this->t('The entity type to which this comment is attached.'))
       ->setSetting('is_ascii', TRUE)
       ->setSetting('max_length', EntityTypeInterface::ID_MAX_LENGTH);
 
     $fields['field_name'] = BaseFieldDefinition::create('string')
-      ->setLabel(t('Comment field name'))
+      ->setLabel($this->t('Comment field name'))
       ->setRequired(TRUE)
-      ->setDescription(t('The field name through which this comment was added.'))
+      ->setDescription($this->t('The field name through which this comment was added.'))
       ->setSetting('is_ascii', TRUE)
       ->setSetting('max_length', FieldStorageConfig::NAME_MAX_LENGTH);
 
diff --git a/core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php b/core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php
index 255b5ab..a17e6d1 100644
--- a/core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php
+++ b/core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php
@@ -55,26 +55,26 @@ public static function defaultFieldSettings() {
    */
   public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
     $properties['status'] = DataDefinition::create('integer')
-      ->setLabel(t('Comment status'))
+      ->setLabel($this->t('Comment status'))
       ->setRequired(TRUE);
 
     $properties['cid'] = DataDefinition::create('integer')
-      ->setLabel(t('Last comment ID'));
+      ->setLabel($this->t('Last comment ID'));
 
     $properties['last_comment_timestamp'] = DataDefinition::create('integer')
-      ->setLabel(t('Last comment timestamp'))
-      ->setDescription(t('The time that the last comment was created.'));
+      ->setLabel($this->t('Last comment timestamp'))
+      ->setDescription($this->t('The time that the last comment was created.'));
 
     $properties['last_comment_name'] = DataDefinition::create('string')
-      ->setLabel(t('Last comment name'))
-      ->setDescription(t('The name of the user posting the last comment.'));
+      ->setLabel($this->t('Last comment name'))
+      ->setDescription($this->t('The name of the user posting the last comment.'));
 
     $properties['last_comment_uid'] = DataDefinition::create('integer')
-      ->setLabel(t('Last comment user ID'));
+      ->setLabel($this->t('Last comment user ID'));
 
     $properties['comment_count'] = DataDefinition::create('integer')
-      ->setLabel(t('Number of comments'))
-      ->setDescription(t('The number of comments.'));
+      ->setLabel($this->t('Number of comments'))
+      ->setDescription($this->t('The number of comments.'));
 
     return $properties;
   }
@@ -108,13 +108,13 @@ public function fieldSettingsForm(array $form, FormStateInterface $form_state) {
 
     $element['default_mode'] = [
       '#type' => 'checkbox',
-      '#title' => t('Threading'),
+      '#title' => $this->t('Threading'),
       '#default_value' => $settings['default_mode'],
-      '#description' => t('Show comment replies in a threaded list.'),
+      '#description' => $this->t('Show comment replies in a threaded list.'),
     ];
     $element['per_page'] = [
       '#type' => 'number',
-      '#title' => t('Comments per page'),
+      '#title' => $this->t('Comments per page'),
       '#default_value' => $settings['per_page'],
       '#required' => TRUE,
       '#min' => 1,
@@ -122,28 +122,28 @@ public function fieldSettingsForm(array $form, FormStateInterface $form_state) {
     ];
     $element['anonymous'] = [
       '#type' => 'select',
-      '#title' => t('Anonymous commenting'),
+      '#title' => $this->t('Anonymous commenting'),
       '#default_value' => $settings['anonymous'],
       '#options' => [
-        CommentInterface::ANONYMOUS_MAYNOT_CONTACT => t('Anonymous posters may not enter their contact information'),
-        CommentInterface::ANONYMOUS_MAY_CONTACT => t('Anonymous posters may leave their contact information'),
-        CommentInterface::ANONYMOUS_MUST_CONTACT => t('Anonymous posters must leave their contact information'),
+        CommentInterface::ANONYMOUS_MAYNOT_CONTACT => $this->t('Anonymous posters may not enter their contact information'),
+        CommentInterface::ANONYMOUS_MAY_CONTACT => $this->t('Anonymous posters may leave their contact information'),
+        CommentInterface::ANONYMOUS_MUST_CONTACT => $this->t('Anonymous posters must leave their contact information'),
       ],
       '#access' => $anonymous_user->hasPermission('post comments'),
     ];
     $element['form_location'] = [
       '#type' => 'checkbox',
-      '#title' => t('Show reply form on the same page as comments'),
+      '#title' => $this->t('Show reply form on the same page as comments'),
       '#default_value' => $settings['form_location'],
     ];
     $element['preview'] = [
       '#type' => 'radios',
-      '#title' => t('Preview comment'),
+      '#title' => $this->t('Preview comment'),
       '#default_value' => $settings['preview'],
       '#options' => [
-        DRUPAL_DISABLED => t('Disabled'),
-        DRUPAL_OPTIONAL => t('Optional'),
-        DRUPAL_REQUIRED => t('Required'),
+        DRUPAL_DISABLED => $this->t('Disabled'),
+        DRUPAL_OPTIONAL => $this->t('Optional'),
+        DRUPAL_REQUIRED => $this->t('Required'),
       ],
     ];
 
@@ -185,7 +185,7 @@ public function storageSettingsForm(array &$form, FormStateInterface $form_state
     }
     $element['comment_type'] = [
       '#type' => 'select',
-      '#title' => t('Comment type'),
+      '#title' => $this->t('Comment type'),
       '#options' => $options,
       '#required' => TRUE,
       '#description' => $this->t('Select the Comment type to use for this comment field. Manage the comment types from the <a href=":url">administration overview page</a>.', [':url' => Url::fromRoute('entity.comment_type.collection')->toString()]),
diff --git a/core/modules/comment/src/Plugin/Field/FieldWidget/CommentWidget.php b/core/modules/comment/src/Plugin/Field/FieldWidget/CommentWidget.php
index c9478f6..a715951 100644
--- a/core/modules/comment/src/Plugin/Field/FieldWidget/CommentWidget.php
+++ b/core/modules/comment/src/Plugin/Field/FieldWidget/CommentWidget.php
@@ -29,22 +29,22 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
 
     $element['status'] = [
       '#type' => 'radios',
-      '#title' => t('Comments'),
+      '#title' => $this->t('Comments'),
       '#title_display' => 'invisible',
       '#default_value' => $items->status,
       '#options' => [
-        CommentItemInterface::OPEN => t('Open'),
-        CommentItemInterface::CLOSED => t('Closed'),
-        CommentItemInterface::HIDDEN => t('Hidden'),
+        CommentItemInterface::OPEN => $this->t('Open'),
+        CommentItemInterface::CLOSED => $this->t('Closed'),
+        CommentItemInterface::HIDDEN => $this->t('Hidden'),
       ],
       CommentItemInterface::OPEN => [
-        '#description' => t('Users with the "Post comments" permission can post comments.'),
+        '#description' => $this->t('Users with the "Post comments" permission can post comments.'),
       ],
       CommentItemInterface::CLOSED => [
-        '#description' => t('Users cannot post comments, but existing comments will be displayed.'),
+        '#description' => $this->t('Users cannot post comments, but existing comments will be displayed.'),
       ],
       CommentItemInterface::HIDDEN => [
-        '#description' => t('Comments are hidden from view.'),
+        '#description' => $this->t('Comments are hidden from view.'),
       ],
     ];
     // If the entity doesn't have any comments, the "hidden" option makes no
@@ -53,7 +53,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
     if (!$this->isDefaultValueWidget($form_state) && !$items->comment_count) {
       $element['status'][CommentItemInterface::HIDDEN]['#access'] = FALSE;
       // Also adjust the description of the "closed" option.
-      $element['status'][CommentItemInterface::CLOSED]['#description'] = t('Users cannot post comments.');
+      $element['status'][CommentItemInterface::CLOSED]['#description'] = $this->t('Users cannot post comments.');
     }
     // If the advanced settings tabs-set is available (normally rendered in the
     // second column on wide-resolutions), place the field as a details element
diff --git a/core/modules/comment/src/Tests/CommentTestBase.php b/core/modules/comment/src/Tests/CommentTestBase.php
index 38096bb..60cf68e 100644
--- a/core/modules/comment/src/Tests/CommentTestBase.php
+++ b/core/modules/comment/src/Tests/CommentTestBase.php
@@ -60,7 +60,7 @@ protected function setUp() {
     // child classes may specify the standard profile.
     $types = NodeType::loadMultiple();
     if (empty($types['article'])) {
-      $this->drupalCreateContentType(['type' => 'article', 'name' => t('Article')]);
+      $this->drupalCreateContentType(['type' => 'article', 'name' => $this->t('Article')]);
     }
 
     // Create two test users.
@@ -146,20 +146,20 @@ public function postComment($entity, $comment, $subject = '', $contact = NULL, $
     switch ($preview_mode) {
       case DRUPAL_REQUIRED:
         // Preview required so no save button should be found.
-        $this->assertNoFieldByName('op', t('Save'), 'Save button not found.');
-        $this->drupalPostForm(NULL, $edit, t('Preview'));
+        $this->assertNoFieldByName('op', $this->t('Save'), 'Save button not found.');
+        $this->drupalPostForm(NULL, $edit, $this->t('Preview'));
         // Don't break here so that we can test post-preview field presence and
         // function below.
       case DRUPAL_OPTIONAL:
-        $this->assertFieldByName('op', t('Preview'), 'Preview button found.');
-        $this->assertFieldByName('op', t('Save'), 'Save button found.');
-        $this->drupalPostForm(NULL, $edit, t('Save'));
+        $this->assertFieldByName('op', $this->t('Preview'), 'Preview button found.');
+        $this->assertFieldByName('op', $this->t('Save'), 'Save button found.');
+        $this->drupalPostForm(NULL, $edit, $this->t('Save'));
         break;
 
       case DRUPAL_DISABLED:
-        $this->assertNoFieldByName('op', t('Preview'), 'Preview button not found.');
-        $this->assertFieldByName('op', t('Save'), 'Save button found.');
-        $this->drupalPostForm(NULL, $edit, t('Save'));
+        $this->assertNoFieldByName('op', $this->t('Preview'), 'Preview button not found.');
+        $this->assertFieldByName('op', $this->t('Save'), 'Save button found.');
+        $this->drupalPostForm(NULL, $edit, $this->t('Save'));
         break;
     }
     $match = [];
@@ -224,8 +224,8 @@ public function commentExists(CommentInterface $comment = NULL, $reply = FALSE)
    *   Comment to delete.
    */
   public function deleteComment(CommentInterface $comment) {
-    $this->drupalPostForm('comment/' . $comment->id() . '/delete', [], t('Delete'));
-    $this->assertText(t('The comment and all its replies have been deleted.'), 'Comment deleted.');
+    $this->drupalPostForm('comment/' . $comment->id() . '/delete', [], $this->t('Delete'));
+    $this->assertText($this->t('The comment and all its replies have been deleted.'), 'Comment deleted.');
   }
 
   /**
@@ -361,14 +361,14 @@ public function performCommentOperation(CommentInterface $comment, $operation, $
     $edit = [];
     $edit['operation'] = $operation;
     $edit['comments[' . $comment->id() . ']'] = TRUE;
-    $this->drupalPostForm('admin/content/comment' . ($approval ? '/approval' : ''), $edit, t('Update'));
+    $this->drupalPostForm('admin/content/comment' . ($approval ? '/approval' : ''), $edit, $this->t('Update'));
 
     if ($operation == 'delete') {
-      $this->drupalPostForm(NULL, [], t('Delete'));
+      $this->drupalPostForm(NULL, [], $this->t('Delete'));
       $this->assertRaw(\Drupal::translation()->formatPlural(1, 'Deleted 1 comment.', 'Deleted @count comments.'), new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => $operation]));
     }
     else {
-      $this->assertText(t('The update has been performed.'), new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => $operation]));
+      $this->assertText($this->t('The update has been performed.'), new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => $operation]));
     }
   }
 
diff --git a/core/modules/comment/src/Tests/Views/CommentTestBase.php b/core/modules/comment/src/Tests/Views/CommentTestBase.php
index 10e56ce..9117adb 100644
--- a/core/modules/comment/src/Tests/Views/CommentTestBase.php
+++ b/core/modules/comment/src/Tests/Views/CommentTestBase.php
@@ -74,7 +74,7 @@ protected function setUp($import_test_views = TRUE) {
     $this->account2 = $this->drupalCreateUser();
     $this->drupalLogin($this->account);
 
-    $this->drupalCreateContentType(['type' => 'page', 'name' => t('Basic page')]);
+    $this->drupalCreateContentType(['type' => 'page', 'name' => $this->t('Basic page')]);
     $this->addDefaultCommentField('node', 'page');
 
     $this->nodeUserPosted = $this->drupalCreateNode();
diff --git a/core/modules/comment/tests/src/Functional/CommentAdminTest.php b/core/modules/comment/tests/src/Functional/CommentAdminTest.php
index 47a3c64..1980e09 100644
--- a/core/modules/comment/tests/src/Functional/CommentAdminTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentAdminTest.php
@@ -42,7 +42,7 @@ public function testApprovalAdminInterface() {
 
     // Test that the comments page loads correctly when there are no comments
     $this->drupalGet('admin/content/comment');
-    $this->assertText(t('No comments available.'));
+    $this->assertText($this->t('No comments available.'));
 
     $this->drupalLogout();
 
@@ -51,7 +51,7 @@ public function testApprovalAdminInterface() {
     $body = $this->randomMachineName();
     // Set $contact to true so that it won't check for id and message.
     $this->postComment($this->node, $body, $subject, TRUE);
-    $this->assertText(t('Your comment has been queued for review by site administrators and will be published after approval.'), 'Comment requires approval.');
+    $this->assertText($this->t('Your comment has been queued for review by site administrators and will be published after approval.'), 'Comment requires approval.');
 
     // Get unapproved comment id.
     $this->drupalLogin($this->adminUser);
@@ -83,13 +83,13 @@ public function testApprovalAdminInterface() {
     // Publish multiple comments in one operation.
     $this->drupalLogin($this->adminUser);
     $this->drupalGet('admin/content/comment/approval');
-    $this->assertText(t('Unapproved comments (@count)', ['@count' => 2]), 'Two unapproved comments waiting for approval.');
+    $this->assertText($this->t('Unapproved comments (@count)', ['@count' => 2]), 'Two unapproved comments waiting for approval.');
     $edit = [
       "comments[{$comments[0]->id()}]" => 1,
       "comments[{$comments[1]->id()}]" => 1,
     ];
-    $this->drupalPostForm(NULL, $edit, t('Update'));
-    $this->assertText(t('Unapproved comments (@count)', ['@count' => 0]), 'All comments were approved.');
+    $this->drupalPostForm(NULL, $edit, $this->t('Update'));
+    $this->assertText($this->t('Unapproved comments (@count)', ['@count' => 0]), 'All comments were approved.');
 
     // Delete multiple comments in one operation.
     $edit = [
@@ -98,16 +98,16 @@ public function testApprovalAdminInterface() {
       "comments[{$comments[1]->id()}]" => 1,
       "comments[{$anonymous_comment4->id()}]" => 1,
     ];
-    $this->drupalPostForm(NULL, $edit, t('Update'));
-    $this->assertText(t('Are you sure you want to delete these comments and all their children?'), 'Confirmation required.');
-    $this->drupalPostForm(NULL, [], t('Delete'));
-    $this->assertText(t('No comments available.'), 'All comments were deleted.');
+    $this->drupalPostForm(NULL, $edit, $this->t('Update'));
+    $this->assertText($this->t('Are you sure you want to delete these comments and all their children?'), 'Confirmation required.');
+    $this->drupalPostForm(NULL, [], $this->t('Delete'));
+    $this->assertText($this->t('No comments available.'), 'All comments were deleted.');
     // Test message when no comments selected.
     $edit = [
       'operation' => 'delete',
     ];
-    $this->drupalPostForm(NULL, $edit, t('Update'));
-    $this->assertText(t('Select one or more comments to perform the update on.'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Update'));
+    $this->assertText($this->t('Select one or more comments to perform the update on.'));
 
     // Make sure the label of unpublished node is not visible on listing page.
     $this->drupalGet('admin/content/comment');
@@ -139,7 +139,7 @@ public function testApprovalNodeInterface() {
     $body = $this->randomMachineName();
     // Set $contact to true so that it won't check for id and message.
     $this->postComment($this->node, $body, $subject, TRUE);
-    $this->assertText(t('Your comment has been queued for review by site administrators and will be published after approval.'), 'Comment requires approval.');
+    $this->assertText($this->t('Your comment has been queued for review by site administrators and will be published after approval.'), 'Comment requires approval.');
 
     // Get unapproved comment id.
     $this->drupalLogin($this->adminUser);
@@ -165,7 +165,7 @@ public function testApprovalNodeInterface() {
     $this->drupalGet('comment/1/edit');
     $this->assertFieldChecked('edit-status-0');
     $this->drupalGet('node/' . $this->node->id());
-    $this->clickLink(t('Approve'));
+    $this->clickLink($this->t('Approve'));
     $this->drupalLogout();
 
     $this->drupalGet('node/' . $this->node->id());
@@ -274,12 +274,12 @@ public function testCommentedTranslationDeletion() {
       "comments[{$comment1->id()}]" => 1,
       "comments[{$comment2->id()}]" => 1,
     ];
-    $this->drupalPostForm('admin/content/comment', $edit, t('Update'));
+    $this->drupalPostForm('admin/content/comment', $edit, $this->t('Update'));
     $this->assertRaw(new FormattableMarkup('@label (Original translation) - <em>The following comment translations will be deleted:</em>', ['@label' => $comment1->label()]));
     $this->assertRaw(new FormattableMarkup('@label (Original translation) - <em>The following comment translations will be deleted:</em>', ['@label' => $comment2->label()]));
     $this->assertText('English');
     $this->assertText('Urdu');
-    $this->drupalPostForm(NULL, [], t('Delete'));
+    $this->drupalPostForm(NULL, [], $this->t('Delete'));
     $after_count = $count_query->execute();
     $this->assertEqual($after_count, $before_count, 'No comment or translation found.');
   }
diff --git a/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php b/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php
index c180531..7b9f272 100644
--- a/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php
@@ -47,7 +47,7 @@ public function testAnonymous() {
     $body = 'comment body with skip comment approval';
     $edit['subject[0][value]'] = $title;
     $edit['comment_body[0][value]'] = $body;
-    $this->drupalPostForm($this->node->toUrl(), $edit, t('Preview'));
+    $this->drupalPostForm($this->node->toUrl(), $edit, $this->t('Preview'));
     // Cannot use assertRaw here since both title and body are in the form.
     $preview = (string) $this->cssSelect('.preview')[0]->getHtml();
     $this->assertTrue(strpos($preview, $title) !== FALSE, 'Anonymous user can preview comment title.');
@@ -60,7 +60,7 @@ public function testAnonymous() {
     $body = 'comment body without skip comment approval';
     $edit['subject[0][value]'] = $title;
     $edit['comment_body[0][value]'] = $body;
-    $this->drupalPostForm($this->node->toUrl(), $edit, t('Preview'));
+    $this->drupalPostForm($this->node->toUrl(), $edit, $this->t('Preview'));
     // Cannot use assertRaw here since both title and body are in the form.
     $preview = (string) $this->cssSelect('.preview')[0]->getHtml();
     $this->assertTrue(strpos($preview, $title) !== FALSE, 'Anonymous user can preview comment title.');
@@ -76,8 +76,8 @@ public function testAnonymous() {
       'name' => $this->adminUser->getAccountName(),
       'comment_body[0][value]' => $this->randomMachineName(),
     ];
-    $this->drupalPostForm('comment/reply/node/' . $this->node->id() . '/comment', $edit, t('Save'));
-    $this->assertRaw(t('The name you used (%name) belongs to a registered user.', [
+    $this->drupalPostForm('comment/reply/node/' . $this->node->id() . '/comment', $edit, $this->t('Save'));
+    $this->assertRaw($this->t('The name you used (%name) belongs to a registered user.', [
       '%name' => $this->adminUser->getAccountName(),
     ]));
 
@@ -109,8 +109,8 @@ public function testAnonymous() {
       'subject[0][value]' => $this->randomMachineName(),
       'comment_body[0][value]' => $this->randomMachineName(),
     ];
-    $this->drupalPostForm('comment/reply/node/' . $this->node->id() . '/comment', $edit, t('Save'));
-    $this->assertRaw(t('The name you used (%name) belongs to a registered user.', [
+    $this->drupalPostForm('comment/reply/node/' . $this->node->id() . '/comment', $edit, $this->t('Save'));
+    $this->assertRaw($this->t('The name you used (%name) belongs to a registered user.', [
       '%name' => $this->adminUser->getAccountName(),
     ]));
 
@@ -125,7 +125,7 @@ public function testAnonymous() {
 
     $anonymous_comment3 = $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName(), TRUE);
     // Name should have 'Anonymous' for value by default.
-    $this->assertText(t('Email field is required.'), 'Email required.');
+    $this->assertText($this->t('Email field is required.'), 'Email required.');
     $this->assertFalse($this->commentExists($anonymous_comment3), 'Anonymous comment with contact info (required) not found.');
 
     // Post comment with contact info (required).
diff --git a/core/modules/comment/tests/src/Functional/CommentBlockTest.php b/core/modules/comment/tests/src/Functional/CommentBlockTest.php
index 954728b..52388c4 100644
--- a/core/modules/comment/tests/src/Functional/CommentBlockTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentBlockTest.php
@@ -43,7 +43,7 @@ protected function setUp() {
    */
   public function testRecentCommentBlock() {
     $this->drupalLogin($this->adminUser);
-    $block = $this->drupalPlaceBlock('views_block:comments_recent-block_1');
+    $this->drupalPlaceBlock('views_block:comments_recent-block_1');
 
     // Add some test comments, with and without subjects. Because the 10 newest
     // comments should be shown by the block, we create 11 to test that behavior
@@ -61,14 +61,14 @@ public function testRecentCommentBlock() {
     $this->drupalLogout();
     user_role_revoke_permissions(RoleInterface::ANONYMOUS_ID, ['access comments']);
     $this->drupalGet('');
-    $this->assertNoText(t('Recent comments'));
+    $this->assertNoText($this->t('Recent comments'));
     user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, ['access comments']);
 
     // Test that a user with the 'access comments' permission can see the
     // block.
     $this->drupalLogin($this->webUser);
     $this->drupalGet('');
-    $this->assertText(t('Recent comments'));
+    $this->assertText($this->t('Recent comments'));
 
     // Test the only the 10 latest comments are shown and in the proper order.
     $this->assertNoText($comments[10]->getSubject(), 'Comment 11 not found in block.');
diff --git a/core/modules/comment/tests/src/Functional/CommentBookTest.php b/core/modules/comment/tests/src/Functional/CommentBookTest.php
index b461f70..fdc916c 100644
--- a/core/modules/comment/tests/src/Functional/CommentBookTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentBookTest.php
@@ -67,16 +67,16 @@ public function testBookCommentPrint() {
 
     $this->assertText($comment_subject, 'Comment subject found');
     $this->assertText($comment_body, 'Comment body found');
-    $this->assertText(t('Add new comment'), 'Comment form found');
+    $this->assertText($this->t('Add new comment'), 'Comment form found');
     $this->assertField('subject[0][value]', 'Comment form subject found');
 
     $this->drupalGet('book/export/html/' . $book_node->id());
 
-    $this->assertText(t('Comments'), 'Comment thread found');
+    $this->assertText($this->t('Comments'), 'Comment thread found');
     $this->assertText($comment_subject, 'Comment subject found');
     $this->assertText($comment_body, 'Comment body found');
 
-    $this->assertNoText(t('Add new comment'), 'Comment form not found');
+    $this->assertNoText($this->t('Add new comment'), 'Comment form not found');
     $this->assertNoField('subject[0][value]', 'Comment form subject not found');
   }
 
diff --git a/core/modules/comment/tests/src/Functional/CommentFieldsTest.php b/core/modules/comment/tests/src/Functional/CommentFieldsTest.php
index 1dd250d..e961a2e 100644
--- a/core/modules/comment/tests/src/Functional/CommentFieldsTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentFieldsTest.php
@@ -164,9 +164,9 @@ public function testCommentFieldCreate() {
 
     // Try to save the comment field without selecting a comment type.
     $edit = [];
-    $this->drupalPostForm('admin/config/people/accounts/fields/user.user.field_user_comment/storage', $edit, t('Save field settings'));
+    $this->drupalPostForm('admin/config/people/accounts/fields/user.user.field_user_comment/storage', $edit, $this->t('Save field settings'));
     // We should get an error message.
-    $this->assertText(t('An illegal choice has been detected. Please contact the site administrator.'));
+    $this->assertText($this->t('An illegal choice has been detected. Please contact the site administrator.'));
 
     // Create a comment type for users.
     $bundle = CommentType::create([
@@ -181,9 +181,9 @@ public function testCommentFieldCreate() {
     $edit = [
       'settings[comment_type]' => 'user_comment_type',
     ];
-    $this->drupalPostForm('admin/config/people/accounts/fields/user.user.field_user_comment/storage', $edit, t('Save field settings'));
+    $this->drupalPostForm('admin/config/people/accounts/fields/user.user.field_user_comment/storage', $edit, $this->t('Save field settings'));
     // We shouldn't get an error message.
-    $this->assertNoText(t('An illegal choice has been detected. Please contact the site administrator.'));
+    $this->assertNoText($this->t('An illegal choice has been detected. Please contact the site administrator.'));
   }
 
   /**
@@ -207,20 +207,20 @@ public function testCommentInstallAfterContentModule() {
     // Uninstall the comment module.
     $edit = [];
     $edit['uninstall[comment]'] = TRUE;
-    $this->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall'));
-    $this->drupalPostForm(NULL, [], t('Uninstall'));
+    $this->drupalPostForm('admin/modules/uninstall', $edit, $this->t('Uninstall'));
+    $this->drupalPostForm(NULL, [], $this->t('Uninstall'));
     $this->rebuildContainer();
     $this->assertFalse($this->container->get('module_handler')->moduleExists('comment'), 'Comment module uninstalled.');
 
     // Install core content type module (book).
     $edit = [];
     $edit['modules[book][enable]'] = 'book';
-    $this->drupalPostForm('admin/modules', $edit, t('Install'));
+    $this->drupalPostForm('admin/modules', $edit, $this->t('Install'));
 
     // Now install the comment module.
     $edit = [];
     $edit['modules[comment][enable]'] = 'comment';
-    $this->drupalPostForm('admin/modules', $edit, t('Install'));
+    $this->drupalPostForm('admin/modules', $edit, $this->t('Install'));
     $this->rebuildContainer();
     $this->assertTrue($this->container->get('module_handler')->moduleExists('comment'), 'Comment module enabled.');
 
diff --git a/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php b/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php
index 2d3dcaa..29df4e0 100644
--- a/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php
@@ -97,20 +97,20 @@ public function testCommentInterface() {
     $this->setCommentPreview(DRUPAL_OPTIONAL);
 
     $this->drupalGet('comment/' . $comment->id() . '/edit');
-    $this->assertTitle(t('Edit comment @title | Drupal', [
+    $this->assertTitle($this->t('Edit comment @title | Drupal', [
       '@title' => $comment->getSubject(),
     ]));
 
     // Test changing the comment author to "Anonymous".
     $comment = $this->postComment(NULL, $comment->comment_body->value, $comment->getSubject(), ['uid' => '']);
-    $this->assertTrue($comment->getAuthorName() == t('Anonymous') && $comment->getOwnerId() == 0, 'Comment author successfully changed to anonymous.');
+    $this->assertTrue($comment->getAuthorName() == $this->t('Anonymous') && $comment->getOwnerId() == 0, 'Comment author successfully changed to anonymous.');
 
     // Test changing the comment author to an unverified user.
     $random_name = $this->randomMachineName();
     $this->drupalGet('comment/' . $comment->id() . '/edit');
     $comment = $this->postComment(NULL, $comment->comment_body->value, $comment->getSubject(), ['name' => $random_name]);
     $this->drupalGet('node/' . $this->node->id());
-    $this->assertText($random_name . ' (' . t('not verified') . ')', 'Comment author successfully changed to an unverified user.');
+    $this->assertText($random_name . ' (' . $this->t('not verified') . ')', 'Comment author successfully changed to an unverified user.');
 
     // Test changing the comment author to a verified user.
     $this->drupalGet('comment/' . $comment->id() . '/edit');
@@ -287,7 +287,7 @@ public function testAutoFilledHtmlSubject() {
       'comment_body[0][value]' => $body_text1,
       'comment_body[0][format]' => 'filtered_html',
     ];
-    $this->drupalPostForm(NULL, $edit1, t('Save'));
+    $this->drupalPostForm(NULL, $edit1, $this->t('Save'));
     $this->assertEqual('Hello World', Comment::load(1)->getSubject());
 
     // If there's nothing other than HTML, the subject should be '(No subject)'.
@@ -296,7 +296,7 @@ public function testAutoFilledHtmlSubject() {
       'comment_body[0][value]' => $body_text2,
       'comment_body[0][format]' => 'filtered_html',
     ];
-    $this->drupalPostForm(NULL, $edit2, t('Save'));
+    $this->drupalPostForm(NULL, $edit2, $this->t('Save'));
     $this->assertEqual('(No subject)', Comment::load(2)->getSubject());
   }
 
diff --git a/core/modules/comment/tests/src/Functional/CommentLanguageTest.php b/core/modules/comment/tests/src/Functional/CommentLanguageTest.php
index 000ecd2..ba988d9 100644
--- a/core/modules/comment/tests/src/Functional/CommentLanguageTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentLanguageTest.php
@@ -45,11 +45,11 @@ protected function setUp() {
 
     // Add language.
     $edit = ['predefined_langcode' => 'fr'];
-    $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language'));
+    $this->drupalPostForm('admin/config/regional/language/add', $edit, $this->t('Add language'));
 
     // Set "Article" content type to use multilingual support.
     $edit = ['language_configuration[language_alterable]' => TRUE];
-    $this->drupalPostForm('admin/structure/types/manage/article', $edit, t('Save content type'));
+    $this->drupalPostForm('admin/structure/types/manage/article', $edit, $this->t('Save content type'));
 
     // Enable content language negotiation UI.
     \Drupal::state()->set('language_test.content_language_type', TRUE);
@@ -63,12 +63,12 @@ protected function setUp() {
       'language_content[enabled][language-url]' => TRUE,
       'language_content[enabled][language-interface]' => FALSE,
     ];
-    $this->drupalPostForm('admin/config/regional/language/detection', $edit, t('Save settings'));
+    $this->drupalPostForm('admin/config/regional/language/detection', $edit, $this->t('Save settings'));
 
     // Change user language preference, this way interface language is always
     // French no matter what path prefix the URLs have.
     $edit = ['preferred_langcode' => 'fr'];
-    $this->drupalPostForm("user/" . $admin_user->id() . "/edit", $edit, t('Save'));
+    $this->drupalPostForm("user/" . $admin_user->id() . "/edit", $edit, $this->t('Save'));
 
     // Create comment field on article.
     $this->addDefaultCommentField('node', 'article');
@@ -100,7 +100,7 @@ public function testCommentLanguage() {
         'langcode[0][value]' => $node_langcode,
         'comment[0][status]' => CommentItemInterface::OPEN,
       ];
-      $this->drupalPostForm("node/add/article", $edit, t('Save'));
+      $this->drupalPostForm("node/add/article", $edit, $this->t('Save'));
       $node = $this->drupalGetNodeByTitle($title);
 
       $prefixes = $this->config('language.negotiation')->get('url.prefixes');
@@ -112,8 +112,8 @@ public function testCommentLanguage() {
           'subject[0][value]' => $this->randomMachineName(),
           'comment_body[0][value]' => $comment_values[$node_langcode][$langcode],
         ];
-        $this->drupalPostForm($prefix . 'node/' . $node->id(), $edit, t('Preview'));
-        $this->drupalPostForm(NULL, $edit, t('Save'));
+        $this->drupalPostForm($prefix . 'node/' . $node->id(), $edit, $this->t('Preview'));
+        $this->drupalPostForm(NULL, $edit, $this->t('Save'));
 
         // Check that comment language matches the current content language.
         $cids = \Drupal::entityQuery('comment')
diff --git a/core/modules/comment/tests/src/Functional/CommentLinksAlterTest.php b/core/modules/comment/tests/src/Functional/CommentLinksAlterTest.php
index 7c4349b..706a0b9 100644
--- a/core/modules/comment/tests/src/Functional/CommentLinksAlterTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentLinksAlterTest.php
@@ -34,7 +34,7 @@ public function testCommentLinksAlter() {
 
     $this->drupalGet('node/' . $this->node->id());
 
-    $this->assertLink(t('Report'));
+    $this->assertLink($this->t('Report'));
   }
 
 }
diff --git a/core/modules/comment/tests/src/Functional/CommentLinksTest.php b/core/modules/comment/tests/src/Functional/CommentLinksTest.php
index 34a815c..ed43350 100644
--- a/core/modules/comment/tests/src/Functional/CommentLinksTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentLinksTest.php
@@ -101,7 +101,7 @@ public function testCommentLinks() {
       // In teaser view, a link containing the comment count is always
       // expected.
       if ($path == 'node') {
-        $this->assertLink(t('1 comment'));
+        $this->assertLink($this->t('1 comment'));
       }
       $this->assertLink('Add new comment');
     }
diff --git a/core/modules/comment/tests/src/Functional/CommentNewIndicatorTest.php b/core/modules/comment/tests/src/Functional/CommentNewIndicatorTest.php
index 99219f1..7bd7ec0 100644
--- a/core/modules/comment/tests/src/Functional/CommentNewIndicatorTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentNewIndicatorTest.php
@@ -60,8 +60,8 @@ public function testCommentNewCommentsIndicator() {
     // node.
     $this->drupalLogin($this->adminUser);
     $this->drupalGet('node');
-    $this->assertNoLink(t('@count comments', ['@count' => 0]));
-    $this->assertLink(t('Read more'));
+    $this->assertNoLink($this->t('@count comments', ['@count' => 0]));
+    $this->assertLink($this->t('Read more'));
     // Verify the data-history-node-last-comment-timestamp attribute, which is
     // used by the drupal.node-new-comments-link library to determine whether
     // a "x new comments" link might be necessary or not. We do this in
diff --git a/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php b/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php
index 0359aa0..a85d973 100644
--- a/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php
@@ -143,20 +143,20 @@ public function postComment(EntityInterface $entity, $comment, $subject = '', $c
     switch ($preview_mode) {
       case DRUPAL_REQUIRED:
         // Preview required so no save button should be found.
-        $this->assertNoFieldByName('op', t('Save'), 'Save button not found.');
-        $this->drupalPostForm(NULL, $edit, t('Preview'));
+        $this->assertNoFieldByName('op', $this->t('Save'), 'Save button not found.');
+        $this->drupalPostForm(NULL, $edit, $this->t('Preview'));
         // Don't break here so that we can test post-preview field presence and
         // function below.
       case DRUPAL_OPTIONAL:
-        $this->assertFieldByName('op', t('Preview'), 'Preview button found.');
-        $this->assertFieldByName('op', t('Save'), 'Save button found.');
-        $this->drupalPostForm(NULL, $edit, t('Save'));
+        $this->assertFieldByName('op', $this->t('Preview'), 'Preview button found.');
+        $this->assertFieldByName('op', $this->t('Save'), 'Save button found.');
+        $this->drupalPostForm(NULL, $edit, $this->t('Save'));
         break;
 
       case DRUPAL_DISABLED:
-        $this->assertNoFieldByName('op', t('Preview'), 'Preview button not found.');
-        $this->assertFieldByName('op', t('Save'), 'Save button found.');
-        $this->drupalPostForm(NULL, $edit, t('Save'));
+        $this->assertNoFieldByName('op', $this->t('Preview'), 'Preview button not found.');
+        $this->assertFieldByName('op', $this->t('Save'), 'Save button found.');
+        $this->drupalPostForm(NULL, $edit, $this->t('Save'));
         break;
     }
     $match = [];
@@ -228,14 +228,14 @@ public function performCommentOperation($comment, $operation, $approval = FALSE)
     $edit = [];
     $edit['operation'] = $operation;
     $edit['comments[' . $comment->id() . ']'] = TRUE;
-    $this->drupalPostForm('admin/content/comment' . ($approval ? '/approval' : ''), $edit, t('Update'));
+    $this->drupalPostForm('admin/content/comment' . ($approval ? '/approval' : ''), $edit, $this->t('Update'));
 
     if ($operation == 'delete') {
-      $this->drupalPostForm(NULL, [], t('Delete'));
+      $this->drupalPostForm(NULL, [], $this->t('Delete'));
       $this->assertRaw(\Drupal::translation()->formatPlural(1, 'Deleted 1 comment.', 'Deleted @count comments.'), new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => $operation]));
     }
     else {
-      $this->assertText(t('The update has been performed.'), new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => $operation]));
+      $this->assertText($this->t('The update has been performed.'), new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => $operation]));
     }
   }
 
@@ -265,7 +265,7 @@ public function testCommentFunctionality() {
     $this->drupalLogin($limited_user);
     // Test that default field exists.
     $this->drupalGet('entity_test/structure/entity_test/fields');
-    $this->assertText(t('Comments'));
+    $this->assertText($this->t('Comments'));
     $this->assertLinkByHref('entity_test/structure/entity_test/fields/entity_test.entity_test.comment');
     // Test widget hidden option is not visible when there's no comments.
     $this->drupalGet('entity_test/structure/entity_test/fields/entity_test.entity_test.comment');
@@ -405,7 +405,7 @@ public function testCommentFunctionality() {
       'default_value_input[comment][0][status]' => CommentItemInterface::CLOSED,
       'settings[anonymous]' => CommentInterface::ANONYMOUS_MAY_CONTACT,
     ];
-    $this->drupalPostForm(NULL, $edit, t('Save settings'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Save settings'));
     $this->drupalGet('entity_test/structure/entity_test/fields/entity_test.entity_test.comment');
     $this->assertNoFieldChecked('edit-default-value-input-comment-0-status-0');
     $this->assertFieldChecked('edit-default-value-input-comment-0-status-1');
@@ -468,7 +468,7 @@ public function testCommentFunctionality() {
     $this->assertNoFieldByName('comment_body[0][value]', '', 'Comment body field not found.');
     // Set subject field to autogenerate it.
     $edit = ['subject[0][value]' => ''];
-    $this->drupalPostForm(NULL, $edit, t('Save'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Save'));
   }
 
   /**
diff --git a/core/modules/comment/tests/src/Functional/CommentPagerTest.php b/core/modules/comment/tests/src/Functional/CommentPagerTest.php
index 25da658..5bed156 100644
--- a/core/modules/comment/tests/src/Functional/CommentPagerTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentPagerTest.php
@@ -45,7 +45,7 @@ public function testCommentPaging() {
     // Check the first page of the node, and confirm the correct comments are
     // shown.
     $this->drupalGet('node/' . $node->id());
-    $this->assertRaw(t('next'), 'Paging links found.');
+    $this->assertRaw($this->t('next'), 'Paging links found.');
     $this->assertTrue($this->commentExists($comments[0]), 'Comment 1 appears on page 1.');
     $this->assertFalse($this->commentExists($comments[1]), 'Comment 2 does not appear on page 1.');
     $this->assertFalse($this->commentExists($comments[2]), 'Comment 3 does not appear on page 1.');
@@ -173,7 +173,6 @@ public function testCommentOrderingThreading() {
     //     - 6
     // - 2
     //   - 5
-
     $this->setCommentSettings('default_mode', CommentManagerInterface::COMMENT_MODE_FLAT, 'Comment paging changed.');
 
     $expected_order = [
@@ -268,7 +267,6 @@ public function testCommentNewPageIndicator() {
     //   - 3
     // - 2
     //   - 5
-
     $this->setCommentSettings('default_mode', CommentManagerInterface::COMMENT_MODE_FLAT, 'Comment paging changed.');
 
     $expected_pages = [
@@ -343,16 +341,16 @@ public function testTwoPagers() {
     $account = $this->drupalCreateUser(['administer node display']);
     $this->drupalLogin($account);
     $this->drupalGet('admin/structure/types/manage/article/display');
-    $this->assertNoText(t('Pager ID: @id', ['@id' => 0]), 'No summary for standard pager');
-    $this->assertText(t('Pager ID: @id', ['@id' => 1]));
+    $this->assertNoText($this->t('Pager ID: @id', ['@id' => 0]), 'No summary for standard pager');
+    $this->assertText($this->t('Pager ID: @id', ['@id' => 1]));
     $this->drupalPostForm(NULL, [], 'comment_settings_edit');
     // Change default pager to 2.
-    $this->drupalPostForm(NULL, ['fields[comment][settings_edit_form][settings][pager_id]' => 2], t('Save'));
-    $this->assertText(t('Pager ID: @id', ['@id' => 2]));
+    $this->drupalPostForm(NULL, ['fields[comment][settings_edit_form][settings][pager_id]' => 2], $this->t('Save'));
+    $this->assertText($this->t('Pager ID: @id', ['@id' => 2]));
     // Revert the changes.
     $this->drupalPostForm(NULL, [], 'comment_settings_edit');
-    $this->drupalPostForm(NULL, ['fields[comment][settings_edit_form][settings][pager_id]' => 0], t('Save'));
-    $this->assertNoText(t('Pager ID: @id', ['@id' => 0]), 'No summary for standard pager');
+    $this->drupalPostForm(NULL, ['fields[comment][settings_edit_form][settings][pager_id]' => 0], $this->t('Save'));
+    $this->assertNoText($this->t('Pager ID: @id', ['@id' => 0]), 'No summary for standard pager');
 
     $this->drupalLogin($this->adminUser);
 
@@ -369,7 +367,7 @@ public function testTwoPagers() {
       // needing to insert large numbers of comments.
       $this->setCommentsPerPage(1, $field_name);
       for ($i = 0; $i < 3; $i++) {
-        $comment = t('Comment @count on field @field', [
+        $comment = $this->t('Comment @count on field @field', [
           '@count' => $i + 1,
           '@field' => $field_name,
         ]);
@@ -380,7 +378,7 @@ public function testTwoPagers() {
     // Check the first page of the node, and confirm the correct comments are
     // shown.
     $this->drupalGet('node/' . $node->id());
-    $this->assertRaw(t('next'), 'Paging links found.');
+    $this->assertRaw($this->t('next'), 'Paging links found.');
     $this->assertRaw('Comment 1 on field comment');
     $this->assertRaw('Comment 1 on field comment_2');
     // Navigate to next page of field 1.
diff --git a/core/modules/comment/tests/src/Functional/CommentPreviewTest.php b/core/modules/comment/tests/src/Functional/CommentPreviewTest.php
index c64eeaa..ac57c9d 100644
--- a/core/modules/comment/tests/src/Functional/CommentPreviewTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentPreviewTest.php
@@ -49,11 +49,11 @@ public function testCommentPreview() {
     $edit = [];
     $edit['subject[0][value]'] = $this->randomMachineName(8);
     $edit['comment_body[0][value]'] = $this->randomMachineName(16);
-    $this->drupalPostForm('node/' . $this->node->id(), $edit, t('Preview'));
+    $this->drupalPostForm('node/' . $this->node->id(), $edit, $this->t('Preview'));
     $this->assertEscaped('<em>' . $this->webUser->id() . '</em>');
 
     \Drupal::state()->set('user_hooks_test_user_format_name_alter_safe', TRUE);
-    $this->drupalPostForm('node/' . $this->node->id(), $edit, t('Preview'));
+    $this->drupalPostForm('node/' . $this->node->id(), $edit, $this->t('Preview'));
     $this->assertTrue($this->webUser->getDisplayName() instanceof MarkupInterface, 'Username is marked safe');
     $this->assertNoEscaped('<em>' . $this->webUser->id() . '</em>');
     $this->assertRaw('<em>' . $this->webUser->id() . '</em>');
@@ -61,13 +61,13 @@ public function testCommentPreview() {
     // Add a user picture.
     $image = current($this->drupalGetTestFiles('image'));
     $user_edit['files[user_picture_0]'] = \Drupal::service('file_system')->realpath($image->uri);
-    $this->drupalPostForm('user/' . $this->webUser->id() . '/edit', $user_edit, t('Save'));
+    $this->drupalPostForm('user/' . $this->webUser->id() . '/edit', $user_edit, $this->t('Save'));
 
     // As the web user, fill in the comment form and preview the comment.
-    $this->drupalPostForm('node/' . $this->node->id(), $edit, t('Preview'));
+    $this->drupalPostForm('node/' . $this->node->id(), $edit, $this->t('Preview'));
 
     // Check that the preview is displaying the title and body.
-    $this->assertTitle(t('Preview comment | Drupal'), 'Page title is "Preview comment".');
+    $this->assertTitle($this->t('Preview comment | Drupal'), 'Page title is "Preview comment".');
     $this->assertText($edit['subject[0][value]'], 'Subject displayed.');
     $this->assertText($edit['comment_body[0][value]'], 'Comment displayed.');
 
@@ -98,10 +98,10 @@ public function testCommentPreviewDuplicateSubmission() {
     $edit = [];
     $edit['subject[0][value]'] = $this->randomMachineName(8);
     $edit['comment_body[0][value]'] = $this->randomMachineName(16);
-    $this->drupalPostForm('node/' . $this->node->id(), $edit, t('Preview'));
+    $this->drupalPostForm('node/' . $this->node->id(), $edit, $this->t('Preview'));
 
     // Check that the preview is displaying the title and body.
-    $this->assertTitle(t('Preview comment | Drupal'), 'Page title is "Preview comment".');
+    $this->assertTitle($this->t('Preview comment | Drupal'), 'Page title is "Preview comment".');
     $this->assertText($edit['subject[0][value]'], 'Subject displayed.');
     $this->assertText($edit['comment_body[0][value]'], 'Comment displayed.');
 
@@ -147,10 +147,10 @@ public function testCommentEditPreviewSave() {
     $expected_form_date = $date->format('Y-m-d');
     $expected_form_time = $date->format('H:i:s');
     $comment = $this->postComment($this->node, $edit['subject[0][value]'], $edit['comment_body[0][value]'], TRUE);
-    $this->drupalPostForm('comment/' . $comment->id() . '/edit', $edit, t('Preview'));
+    $this->drupalPostForm('comment/' . $comment->id() . '/edit', $edit, $this->t('Preview'));
 
     // Check that the preview is displaying the subject, comment, author and date correctly.
-    $this->assertTitle(t('Preview comment | Drupal'), 'Page title is "Preview comment".');
+    $this->assertTitle($this->t('Preview comment | Drupal'), 'Page title is "Preview comment".');
     $this->assertText($edit['subject[0][value]'], 'Subject displayed.');
     $this->assertText($edit['comment_body[0][value]'], 'Comment displayed.');
     $this->assertText($web_user->getAccountName(), 'Author displayed.');
@@ -164,8 +164,8 @@ public function testCommentEditPreviewSave() {
     $this->assertFieldByName('date[time]', $edit['date[time]'], 'Time field displayed.');
 
     // Check that saving a comment produces a success message.
-    $this->drupalPostForm('comment/' . $comment->id() . '/edit', $edit, t('Save'));
-    $this->assertText(t('Your comment has been posted.'), 'Comment posted.');
+    $this->drupalPostForm('comment/' . $comment->id() . '/edit', $edit, $this->t('Save'));
+    $this->assertText($this->t('Your comment has been posted.'), 'Comment posted.');
 
     // Check that the comment fields are correct after loading the saved comment.
     $this->drupalGet('comment/' . $comment->id() . '/edit');
@@ -182,7 +182,7 @@ public function testCommentEditPreviewSave() {
     $displayed['uid'] = current($this->xpath("//input[@id='edit-uid']"))->getValue();
     $displayed['date[date]'] = current($this->xpath("//input[@id='edit-date-date']"))->getValue();
     $displayed['date[time]'] = current($this->xpath("//input[@id='edit-date-time']"))->getValue();
-    $this->drupalPostForm('comment/' . $comment->id() . '/edit', $displayed, t('Save'));
+    $this->drupalPostForm('comment/' . $comment->id() . '/edit', $displayed, $this->t('Save'));
 
     // Check that the saved comment is still correct.
     $comment_storage = \Drupal::entityTypeManager()->getStorage('comment');
@@ -202,7 +202,7 @@ public function testCommentEditPreviewSave() {
     $this->drupalLogin($web_user);
     // Web user cannot change the comment author.
     unset($edit['uid']);
-    $this->drupalPostForm('comment/' . $comment->id() . '/edit', $user_edit, t('Save'));
+    $this->drupalPostForm('comment/' . $comment->id() . '/edit', $user_edit, $this->t('Save'));
     $comment_storage->resetCache([$comment->id()]);
     $comment_loaded = Comment::load($comment->id());
     $this->assertEqual($comment_loaded->getCreatedTime(), $expected_created_time, 'Expected date and time for comment edited.');
diff --git a/core/modules/comment/tests/src/Functional/CommentStatusFieldAccessTest.php b/core/modules/comment/tests/src/Functional/CommentStatusFieldAccessTest.php
index 7009ea2..2fe2b4b 100644
--- a/core/modules/comment/tests/src/Functional/CommentStatusFieldAccessTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentStatusFieldAccessTest.php
@@ -57,7 +57,7 @@ protected function setUp() {
     parent::setUp();
     $node_type = NodeType::create([
       'type' => 'article',
-      'name' => t('Article'),
+      'name' => $this->t('Article'),
     ]);
     $node_type->save();
     $this->nodeAuthor = $this->drupalCreateUser([
@@ -90,14 +90,14 @@ public function testCommentStatusFieldAccessStatus() {
     $assert->fieldNotExists('comment[0][status]');
     $this->submitForm([
       'title[0][value]' => 'Node 1',
-    ], t('Save'));
+    ], $this->t('Save'));
     $assert->fieldExists('subject[0][value]');
     $this->drupalLogin($this->commentAdmin);
     $this->drupalGet('node/add/article');
     $assert->fieldExists('comment[0][status]');
     $this->submitForm([
       'title[0][value]' => 'Node 2',
-    ], t('Save'));
+    ], $this->t('Save'));
     $assert->fieldExists('subject[0][value]');
   }
 
diff --git a/core/modules/comment/tests/src/Functional/CommentTestBase.php b/core/modules/comment/tests/src/Functional/CommentTestBase.php
index 245228d..b216c6c 100644
--- a/core/modules/comment/tests/src/Functional/CommentTestBase.php
+++ b/core/modules/comment/tests/src/Functional/CommentTestBase.php
@@ -54,7 +54,7 @@ protected function setUp() {
     // child classes may specify the standard profile.
     $types = NodeType::loadMultiple();
     if (empty($types['article'])) {
-      $this->drupalCreateContentType(['type' => 'article', 'name' => t('Article')]);
+      $this->drupalCreateContentType(['type' => 'article', 'name' => $this->t('Article')]);
     }
 
     // Create two test users.
@@ -141,20 +141,20 @@ public function postComment($entity, $comment, $subject = '', $contact = NULL, $
     switch ($preview_mode) {
       case DRUPAL_REQUIRED:
         // Preview required so no save button should be found.
-        $this->assertNoFieldByName('op', t('Save'), 'Save button not found.');
-        $this->drupalPostForm(NULL, $edit, t('Preview'));
+        $this->assertNoFieldByName('op', $this->t('Save'), 'Save button not found.');
+        $this->drupalPostForm(NULL, $edit, $this->t('Preview'));
         // Don't break here so that we can test post-preview field presence and
         // function below.
       case DRUPAL_OPTIONAL:
-        $this->assertFieldByName('op', t('Preview'), 'Preview button found.');
-        $this->assertFieldByName('op', t('Save'), 'Save button found.');
-        $this->drupalPostForm(NULL, $edit, t('Save'));
+        $this->assertFieldByName('op', $this->t('Preview'), 'Preview button found.');
+        $this->assertFieldByName('op', $this->t('Save'), 'Save button found.');
+        $this->drupalPostForm(NULL, $edit, $this->t('Save'));
         break;
 
       case DRUPAL_DISABLED:
-        $this->assertNoFieldByName('op', t('Preview'), 'Preview button not found.');
-        $this->assertFieldByName('op', t('Save'), 'Save button found.');
-        $this->drupalPostForm(NULL, $edit, t('Save'));
+        $this->assertNoFieldByName('op', $this->t('Preview'), 'Preview button not found.');
+        $this->assertFieldByName('op', $this->t('Save'), 'Save button found.');
+        $this->drupalPostForm(NULL, $edit, $this->t('Save'));
         break;
     }
     $match = [];
@@ -219,8 +219,8 @@ public function commentExists(CommentInterface $comment = NULL, $reply = FALSE)
    *   Comment to delete.
    */
   public function deleteComment(CommentInterface $comment) {
-    $this->drupalPostForm('comment/' . $comment->id() . '/delete', [], t('Delete'));
-    $this->assertText(t('The comment and all its replies have been deleted.'), 'Comment deleted.');
+    $this->drupalPostForm('comment/' . $comment->id() . '/delete', [], $this->t('Delete'));
+    $this->assertText($this->t('The comment and all its replies have been deleted.'), 'Comment deleted.');
   }
 
   /**
@@ -357,14 +357,14 @@ public function performCommentOperation(CommentInterface $comment, $operation, $
     $edit = [];
     $edit['operation'] = $operation;
     $edit['comments[' . $comment->id() . ']'] = TRUE;
-    $this->drupalPostForm('admin/content/comment' . ($approval ? '/approval' : ''), $edit, t('Update'));
+    $this->drupalPostForm('admin/content/comment' . ($approval ? '/approval' : ''), $edit, $this->t('Update'));
 
     if ($operation == 'delete') {
-      $this->drupalPostForm(NULL, [], t('Delete'));
+      $this->drupalPostForm(NULL, [], $this->t('Delete'));
       $this->assertRaw(\Drupal::translation()->formatPlural(1, 'Deleted 1 comment.', 'Deleted @count comments.'), new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => $operation]));
     }
     else {
-      $this->assertText(t('The update has been performed.'), new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => $operation]));
+      $this->assertText($this->t('The update has been performed.'), new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => $operation]));
     }
   }
 
diff --git a/core/modules/comment/tests/src/Functional/CommentThreadingTest.php b/core/modules/comment/tests/src/Functional/CommentThreadingTest.php
index 50217d3..60c903c 100644
--- a/core/modules/comment/tests/src/Functional/CommentThreadingTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentThreadingTest.php
@@ -164,7 +164,6 @@ protected function assertNoParentLink($cid) {
     // <article>
     //   <p class="parent"></p>
     //  </article>
-
     $pattern = "//article[@id='comment-$cid']//p[contains(@class, 'parent')]";
     $this->assertNoFieldByXpath($pattern, NULL, new FormattableMarkup(
       'Comment %cid does not have a link to a parent.',
diff --git a/core/modules/comment/tests/src/Functional/CommentTranslationUITest.php b/core/modules/comment/tests/src/Functional/CommentTranslationUITest.php
index 8f47909..a1cdc57 100644
--- a/core/modules/comment/tests/src/Functional/CommentTranslationUITest.php
+++ b/core/modules/comment/tests/src/Functional/CommentTranslationUITest.php
@@ -223,7 +223,7 @@ protected function doTestTranslationEdit() {
         $url = $entity->toUrl('edit-form', $options);
         $this->drupalGet($url);
 
-        $title = t('Edit @type @title [%language translation]', [
+        $title = $this->t('Edit @type @title [%language translation]', [
           '@type' => $this->entityTypeId,
           '@title' => $entity->getTranslation($langcode)->label(),
           '%language' => $languages[$langcode]->getName(),
diff --git a/core/modules/comment/tests/src/Functional/CommentTypeTest.php b/core/modules/comment/tests/src/Functional/CommentTypeTest.php
index 8c0b355..f88afc9 100644
--- a/core/modules/comment/tests/src/Functional/CommentTypeTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentTypeTest.php
@@ -74,7 +74,7 @@ public function testCommentTypeCreation() {
       'description' => '',
       'target_entity_type_id' => 'node',
     ];
-    $this->drupalPostForm('admin/structure/comment/types/add', $edit, t('Save'));
+    $this->drupalPostForm('admin/structure/comment/types/add', $edit, $this->t('Save'));
     $comment_type = CommentType::load('foo');
     $this->assertInstanceOf(CommentType::class, $comment_type, 'The new comment type has been created.');
 
@@ -85,10 +85,10 @@ public function testCommentTypeCreation() {
     // Edit the comment-type and ensure that we cannot change the entity-type.
     $this->drupalGet('admin/structure/comment/manage/foo');
     $this->assertNoField('target_entity_type_id', 'Entity type file not present');
-    $this->assertText(t('Target entity type'));
+    $this->assertText($this->t('Target entity type'));
     // Save the form and ensure the entity-type value is preserved even though
     // the field isn't present.
-    $this->drupalPostForm(NULL, [], t('Save'));
+    $this->drupalPostForm(NULL, [], $this->t('Save'));
     \Drupal::entityTypeManager()->getStorage('comment_type')->resetCache(['foo']);
     $comment_type = CommentType::load('foo');
     $this->assertEqual($comment_type->getTargetEntityTypeId(), 'node');
@@ -108,7 +108,7 @@ public function testCommentTypeEditing() {
     $edit = [
       'label' => 'Bar',
     ];
-    $this->drupalPostForm('admin/structure/comment/manage/comment', $edit, t('Save'));
+    $this->drupalPostForm('admin/structure/comment/manage/comment', $edit, $this->t('Save'));
 
     $this->drupalGet('admin/structure/comment');
     $this->assertRaw('Bar', 'New name was displayed.');
@@ -117,9 +117,9 @@ public function testCommentTypeEditing() {
     $this->assertCount(1, $this->cssSelect('tr#comment-body'), 'Body field exists.');
 
     // Remove the body field.
-    $this->drupalPostForm('admin/structure/comment/manage/comment/fields/comment.comment.comment_body/delete', [], t('Delete'));
+    $this->drupalPostForm('admin/structure/comment/manage/comment/fields/comment.comment.comment_body/delete', [], $this->t('Delete'));
     // Resave the settings for this type.
-    $this->drupalPostForm('admin/structure/comment/manage/comment', [], t('Save'));
+    $this->drupalPostForm('admin/structure/comment/manage/comment', [], $this->t('Save'));
     // Check that the body field doesn't exist.
     $this->drupalGet('admin/structure/comment/manage/comment/fields');
     $this->assertCount(0, $this->cssSelect('tr#comment-body'), 'Body field does not exist.');
@@ -156,17 +156,17 @@ public function testCommentTypeDeletion() {
     // Attempt to delete the comment type, which should not be allowed.
     $this->drupalGet('admin/structure/comment/manage/' . $type->id() . '/delete');
     $this->assertRaw(
-      t('%label is used by 1 comment on your site. You can not remove this comment type until you have removed all of the %label comments.', ['%label' => $type->label()]),
+      $this->t('%label is used by 1 comment on your site. You can not remove this comment type until you have removed all of the %label comments.', ['%label' => $type->label()]),
       'The comment type will not be deleted until all comments of that type are removed.'
     );
     $this->assertRaw(
-      t('%label is used by the %field field on your site. You can not remove this comment type until you have removed the field.', [
+      $this->t('%label is used by the %field field on your site. You can not remove this comment type until you have removed the field.', [
         '%label' => 'foo',
         '%field' => 'node.foo',
       ]),
       'The comment type will not be deleted until all fields of that type are removed.'
     );
-    $this->assertNoText(t('This action cannot be undone.'), 'The comment type deletion confirmation form is not available.');
+    $this->assertNoText($this->t('This action cannot be undone.'), 'The comment type deletion confirmation form is not available.');
 
     // Delete the comment and the field.
     $comment->delete();
@@ -174,10 +174,10 @@ public function testCommentTypeDeletion() {
     // Attempt to delete the comment type, which should now be allowed.
     $this->drupalGet('admin/structure/comment/manage/' . $type->id() . '/delete');
     $this->assertRaw(
-      t('Are you sure you want to delete the comment type %type?', ['%type' => $type->id()]),
+      $this->t('Are you sure you want to delete the comment type %type?', ['%type' => $type->id()]),
       'The comment type is available for deletion.'
     );
-    $this->assertText(t('This action cannot be undone.'), 'The comment type deletion confirmation form is available.');
+    $this->assertText($this->t('This action cannot be undone.'), 'The comment type deletion confirmation form is available.');
 
     // Test exception thrown when re-using an existing comment type.
     try {
@@ -189,9 +189,9 @@ public function testCommentTypeDeletion() {
     }
 
     // Delete the comment type.
-    $this->drupalPostForm('admin/structure/comment/manage/' . $type->id() . '/delete', [], t('Delete'));
+    $this->drupalPostForm('admin/structure/comment/manage/' . $type->id() . '/delete', [], $this->t('Delete'));
     $this->assertNull(CommentType::load($type->id()), 'Comment type deleted.');
-    $this->assertRaw(t('The comment type %label has been deleted.', ['%label' => $type->label()]));
+    $this->assertRaw($this->t('The comment type %label has been deleted.', ['%label' => $type->label()]));
   }
 
 }
diff --git a/core/modules/comment/tests/src/Functional/Update/CommentAdminViewUpdateTest.php b/core/modules/comment/tests/src/Functional/Update/CommentAdminViewUpdateTest.php
index 65c36e6..bac6208 100644
--- a/core/modules/comment/tests/src/Functional/Update/CommentAdminViewUpdateTest.php
+++ b/core/modules/comment/tests/src/Functional/Update/CommentAdminViewUpdateTest.php
@@ -46,7 +46,7 @@ public function testCommentAdminPostUpdateHook() {
     $account = $this->drupalCreateUser(['administer comments']);
     $this->drupalLogin($account);
     $this->drupalGet('admin/content/comment');
-    $this->assertText(t('No comments available.'));
+    $this->assertText($this->t('No comments available.'));
   }
 
 }
diff --git a/core/modules/comment/tests/src/Functional/Views/CommentAdminTest.php b/core/modules/comment/tests/src/Functional/Views/CommentAdminTest.php
index a31ad26..802c388 100644
--- a/core/modules/comment/tests/src/Functional/Views/CommentAdminTest.php
+++ b/core/modules/comment/tests/src/Functional/Views/CommentAdminTest.php
@@ -53,7 +53,7 @@ public function testApprovalAdminInterface() {
 
     // Test that the comments page loads correctly when there are no comments.
     $this->drupalGet('admin/content/comment');
-    $this->assertText(t('No comments available.'));
+    $this->assertText($this->t('No comments available.'));
 
     // Assert the expose filters on the admin page.
     $this->assertField('subject');
@@ -69,8 +69,8 @@ public function testApprovalAdminInterface() {
     $this->drupalPostForm('comment/reply/node/' . $this->node->id() . '/comment', [
       'name' => $author_name,
       'comment_body[0][value]' => $body,
-    ], t('Save'));
-    $this->assertText(t('Your comment has been queued for review by site administrators and will be published after approval.'), 'Comment requires approval.');
+    ], $this->t('Save'));
+    $this->assertText($this->t('Your comment has been queued for review by site administrators and will be published after approval.'), 'Comment requires approval.');
 
     // Get unapproved comment id.
     $this->drupalLogin($this->adminUser);
@@ -92,7 +92,7 @@ public function testApprovalAdminInterface() {
     $edit = [];
     $edit['action'] = 'comment_publish_action';
     $edit['comment_bulk_form[0]'] = $anonymous_comment4->id();
-    $this->drupalPostForm('admin/content/comment/approval', $edit, t('Apply to selected items'));
+    $this->drupalPostForm('admin/content/comment/approval', $edit, $this->t('Apply to selected items'));
 
     $this->assertText('Publish comment was applied to 1 item.', new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => 'publish']));
     $this->drupalLogout();
@@ -107,7 +107,7 @@ public function testApprovalAdminInterface() {
     // Publish multiple comments in one operation.
     $this->drupalLogin($this->adminUser);
     $this->drupalGet('admin/content/comment/approval');
-    $this->assertText(t('Unapproved comments (@count)', ['@count' => 2]), 'Two unapproved comments waiting for approval.');
+    $this->assertText($this->t('Unapproved comments (@count)', ['@count' => 2]), 'Two unapproved comments waiting for approval.');
 
     // Assert the expose filters on the admin page.
     $this->assertField('subject');
@@ -119,12 +119,12 @@ public function testApprovalAdminInterface() {
       "comment_bulk_form[1]" => $comments[0]->id(),
       "comment_bulk_form[0]" => $comments[1]->id(),
     ];
-    $this->drupalPostForm(NULL, $edit, t('Apply to selected items'));
-    $this->assertText(t('Unapproved comments (@count)', ['@count' => 0]), 'All comments were approved.');
+    $this->drupalPostForm(NULL, $edit, $this->t('Apply to selected items'));
+    $this->assertText($this->t('Unapproved comments (@count)', ['@count' => 0]), 'All comments were approved.');
 
     // Test message when no comments selected.
-    $this->drupalPostForm('admin/content/comment', [], t('Apply to selected items'));
-    $this->assertText(t('Select one or more comments to perform the update on.'));
+    $this->drupalPostForm('admin/content/comment', [], $this->t('Apply to selected items'));
+    $this->assertText($this->t('Select one or more comments to perform the update on.'));
 
     $subject_link = $this->xpath('//table/tbody/tr/td/a[contains(@href, :href) and contains(@title, :title) and text()=:text]', [
       ':href' => $comments[0]->permalink()->toString(),
@@ -149,10 +149,10 @@ public function testApprovalAdminInterface() {
       "comment_bulk_form[0]" => $comments[1]->id(),
       "comment_bulk_form[2]" => $anonymous_comment4->id(),
     ];
-    $this->drupalPostForm(NULL, $edit, t('Apply to selected items'));
-    $this->assertText(t('Are you sure you want to delete these comments and all their children?'), 'Confirmation required.');
-    $this->drupalPostForm(NULL, [], t('Delete'));
-    $this->assertText(t('No comments available.'), 'All comments were deleted.');
+    $this->drupalPostForm(NULL, $edit, $this->t('Apply to selected items'));
+    $this->assertText($this->t('Are you sure you want to delete these comments and all their children?'), 'Confirmation required.');
+    $this->drupalPostForm(NULL, [], $this->t('Delete'));
+    $this->assertText($this->t('No comments available.'), 'All comments were deleted.');
 
     // Make sure the label of unpublished node is not visible on listing page.
     $this->drupalGet('admin/content/comment');
diff --git a/core/modules/comment/tests/src/Functional/Views/CommentEditTest.php b/core/modules/comment/tests/src/Functional/Views/CommentEditTest.php
index fb5f736..17b87a0 100644
--- a/core/modules/comment/tests/src/Functional/Views/CommentEditTest.php
+++ b/core/modules/comment/tests/src/Functional/Views/CommentEditTest.php
@@ -29,7 +29,7 @@ public function testCommentEdit() {
     $edit = [
       'comment_body[0][value]' => $this->randomMachineName(),
     ];
-    $this->drupalPostForm(NULL, $edit, t('Save'));
+    $this->drupalPostForm(NULL, $edit, $this->t('Save'));
     $this->drupalGet('admin/content/comment');
     $this->assertText($this->adminUser->label());
   }
diff --git a/core/modules/comment/tests/src/Functional/Views/CommentTestBase.php b/core/modules/comment/tests/src/Functional/Views/CommentTestBase.php
index a9444a2..be213c5 100644
--- a/core/modules/comment/tests/src/Functional/Views/CommentTestBase.php
+++ b/core/modules/comment/tests/src/Functional/Views/CommentTestBase.php
@@ -67,7 +67,7 @@ protected function setUp($import_test_views = TRUE) {
     $this->account2 = $this->drupalCreateUser();
     $this->drupalLogin($this->account);
 
-    $this->drupalCreateContentType(['type' => 'page', 'name' => t('Basic page')]);
+    $this->drupalCreateContentType(['type' => 'page', 'name' => $this->t('Basic page')]);
     $this->addDefaultCommentField('node', 'page');
 
     $this->nodeUserPosted = $this->drupalCreateNode();
diff --git a/core/modules/comment/tests/src/Functional/Views/WizardTest.php b/core/modules/comment/tests/src/Functional/Views/WizardTest.php
index 1bf53a1..13522ee 100644
--- a/core/modules/comment/tests/src/Functional/Views/WizardTest.php
+++ b/core/modules/comment/tests/src/Functional/Views/WizardTest.php
@@ -33,7 +33,7 @@ class WizardTest extends WizardTestBase {
    */
   protected function setUp($import_test_views = TRUE) {
     parent::setUp($import_test_views);
-    $this->drupalCreateContentType(['type' => 'page', 'name' => t('Basic page')]);
+    $this->drupalCreateContentType(['type' => 'page', 'name' => $this->t('Basic page')]);
     // Add comment field to page node type.
     $this->addDefaultCommentField('node', 'page');
   }
@@ -51,14 +51,13 @@ public function testCommentWizard() {
 
     // Just triggering the saving should automatically choose a proper row
     // plugin.
-    $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit'));
+    $this->drupalPostForm('admin/structure/views/add', $view, $this->t('Save and edit'));
     $this->assertUrl('admin/structure/views/view/' . $view['id'], [], 'Make sure the view saving was successful and the browser got redirected to the edit page.');
 
     // If we update the type first we should get a selection of comment valid
     // row plugins as the select field.
-
     $this->drupalGet('admin/structure/views/add');
-    $this->drupalPostForm('admin/structure/views/add', $view, t('Update "of type" choice'));
+    $this->drupalPostForm('admin/structure/views/add', $view, $this->t('Update "of type" choice'));
 
     // Check for available options of the row plugin.
     $xpath = $this->constructFieldXpath('name', 'page[style][row_plugin]');
@@ -74,7 +73,7 @@ public function testCommentWizard() {
     $this->assertEqual($options, $expected_options);
 
     $view['id'] = strtolower($this->randomMachineName(16));
-    $this->drupalPostForm(NULL, $view, t('Save and edit'));
+    $this->drupalPostForm(NULL, $view, $this->t('Save and edit'));
     $this->assertUrl('admin/structure/views/view/' . $view['id'], [], 'Make sure the view saving was successful and the browser got redirected to the edit page.');
 
     $user = $this->drupalCreateUser(['access comments']);
diff --git a/core/modules/comment/tests/src/Kernel/CommentValidationTest.php b/core/modules/comment/tests/src/Kernel/CommentValidationTest.php
index 411ad54..fa17fc7 100644
--- a/core/modules/comment/tests/src/Kernel/CommentValidationTest.php
+++ b/core/modules/comment/tests/src/Kernel/CommentValidationTest.php
@@ -101,7 +101,7 @@ public function testValidation() {
     $violations = $comment->validate();
     $this->assertEqual(count($violations), 1, "Violation found on author name collision");
     $this->assertEqual($violations[0]->getPropertyPath(), "name");
-    $this->assertEqual($violations[0]->getMessage(), t('The name you used (%name) belongs to a registered user.', ['%name' => 'test']));
+    $this->assertEqual($violations[0]->getMessage(), $this->t('The name you used (%name) belongs to a registered user.', ['%name' => 'test']));
 
     // Make the name valid.
     $comment->set('name', 'valid unused name');
@@ -109,7 +109,7 @@ public function testValidation() {
     $violations = $comment->validate();
     $this->assertEqual(count($violations), 1, 'Violation found when email is invalid');
     $this->assertEqual($violations[0]->getPropertyPath(), 'mail.0.value');
-    $this->assertEqual($violations[0]->getMessage(), t('This value is not a valid email address.'));
+    $this->assertEqual($violations[0]->getMessage(), $this->t('This value is not a valid email address.'));
 
     $comment->set('mail', NULL);
     $comment->set('homepage', 'http://example.com/' . $this->randomMachineName(237));
@@ -122,7 +122,7 @@ public function testValidation() {
 
     // @todo This message should be improved in
     //   https://www.drupal.org/node/2012690.
-    $this->assertEqual($violations[0]->getMessage(), t('This value should be of the correct primitive type.'));
+    $this->assertEqual($violations[0]->getMessage(), $this->t('This value should be of the correct primitive type.'));
 
     $comment->set('homepage', NULL);
     $comment->set('hostname', $this->randomString(129));
@@ -152,7 +152,7 @@ public function testValidation() {
     $violations = $comment->validate();
     $this->assertEqual(count($violations), 1, 'Violation found when name is required, but empty and UID is anonymous.');
     $this->assertEqual($violations[0]->getPropertyPath(), 'name');
-    $this->assertEqual($violations[0]->getMessage(), t('You have to specify a valid author.'));
+    $this->assertEqual($violations[0]->getMessage(), $this->t('You have to specify a valid author.'));
 
     // Test creating a default comment with a given user id works.
     $comment = $this->entityTypeManager->getStorage('comment')->create([
@@ -177,7 +177,7 @@ public function testValidation() {
     $violations = $comment->validate();
     $this->assertEqual(count($violations), 1, 'Violation found when author name and comment author do not match.');
     $this->assertEqual($violations[0]->getPropertyPath(), 'name');
-    $this->assertEqual($violations[0]->getMessage(), t('The specified author name does not match the comment author.'));
+    $this->assertEqual($violations[0]->getMessage(), $this->t('The specified author name does not match the comment author.'));
   }
 
   /**
@@ -195,7 +195,7 @@ protected function assertLengthViolation(CommentInterface $comment, $field_name,
     $this->assertEqual(count($violations), 1, "Violation found when $field_name is too long.");
     $this->assertEqual($violations[0]->getPropertyPath(), "$field_name.0.value");
     $field_label = $comment->get($field_name)->getFieldDefinition()->getLabel();
-    $this->assertEqual($violations[0]->getMessage(), t('%name: may not be longer than @max characters.', ['%name' => $field_label, '@max' => $length]));
+    $this->assertEqual($violations[0]->getMessage(), $this->t('%name: may not be longer than @max characters.', ['%name' => $field_label, '@max' => $length]));
   }
 
 }
diff --git a/core/modules/comment/tests/src/Kernel/Views/CommentViewsFieldAccessTest.php b/core/modules/comment/tests/src/Kernel/Views/CommentViewsFieldAccessTest.php
index 7cef38b..c73f143 100644
--- a/core/modules/comment/tests/src/Kernel/Views/CommentViewsFieldAccessTest.php
+++ b/core/modules/comment/tests/src/Kernel/Views/CommentViewsFieldAccessTest.php
@@ -67,7 +67,6 @@ public function testCommentFields() {
     $comment_anonymous->save();
 
     // @todo Expand the test coverage in https://www.drupal.org/node/2464635
-
     $this->assertFieldAccess('comment', 'cid', $comment->id());
     $this->assertFieldAccess('comment', 'cid', $comment_anonymous->id());
     $this->assertFieldAccess('comment', 'uuid', $comment->uuid());
