diff --git a/core/modules/announcements_feed/src/LazyBuilders.php b/core/modules/announcements_feed/src/LazyBuilders.php
index 8c3aa5691793d7e7c6014be95d782f3ca2c0dd26..f8f0a1866c85e3c3a8606e19a24c25b2b475921a 100644
--- a/core/modules/announcements_feed/src/LazyBuilders.php
+++ b/core/modules/announcements_feed/src/LazyBuilders.php
@@ -8,6 +8,7 @@
 use Drupal\Component\Utility\Html;
 use Drupal\Core\Render\ElementInfoManagerInterface;
 use Drupal\Core\Security\TrustedCallbackInterface;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
 use Drupal\Core\Url;
 
 /**
@@ -17,6 +18,8 @@
  */
 final class LazyBuilders implements TrustedCallbackInterface {
 
+  use StringTranslationTrait;
+
   /**
    * Constructs LazyBuilders object.
    *
@@ -40,11 +43,11 @@ public function renderAnnouncements(): array {
       '#cache' => [
         'context' => ['user.permissions'],
       ],
-      '#title' => t('Announcements'),
+      '#title' => $this->t('Announcements'),
       '#url' => Url::fromRoute('announcements_feed.announcement'),
       '#id' => Html::getId('toolbar-item-announcement'),
       '#attributes' => [
-        'title' => t('Announcements'),
+        'title' => $this->t('Announcements'),
         'data-drupal-announce-trigger' => '',
         'class' => [
           'toolbar-icon',
diff --git a/core/modules/comment/src/CommentForm.php b/core/modules/comment/src/CommentForm.php
index c9daaa1859e05cc75ce0a118667d6c87acdb216e..22cfc5d5813947eb0b661f309b8549aa7e6f7260 100644
--- a/core/modules/comment/src/CommentForm.php
+++ b/core/modules/comment/src/CommentForm.php
@@ -392,7 +392,7 @@ public function save(array $form, FormStateInterface $form_state) {
       // Add a log entry.
       $logger->info('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(),
       ]);
       // Add an appropriate message upon submitting the comment form.
       $this->messenger()->addStatus($this->getStatusMessage($comment, $is_new));
diff --git a/core/modules/comment/src/CommentLazyBuilders.php b/core/modules/comment/src/CommentLazyBuilders.php
index a3d3df36848d032f27bf37381a6f9e9621a9b527..458e3689077a701cc82098533b828f6fb5a13261 100644
--- a/core/modules/comment/src/CommentLazyBuilders.php
+++ b/core/modules/comment/src/CommentLazyBuilders.php
@@ -11,6 +11,7 @@
 use Drupal\Core\Security\TrustedCallbackInterface;
 use Drupal\Core\Render\RendererInterface;
 use Drupal\Core\Session\AccountInterface;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
 use Drupal\Core\Url;
 
 /**
@@ -18,6 +19,8 @@
  */
 class CommentLazyBuilders implements TrustedCallbackInterface {
 
+  use StringTranslationTrait;
+
   /**
    * The entity type manager service.
    *
@@ -172,14 +175,14 @@ 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'),
         ];
       }
@@ -188,7 +191,7 @@ protected function buildLinks(CommentInterface $entity, EntityInterface $comment
         && $entity->access('create')
         && $field_definition->getSetting('default_mode') === CommentManagerInterface::COMMENT_MODE_THREADED) {
         $links['comment-reply'] = [
-          'title' => t('Reply'),
+          'title' => $this->t('Reply'),
           'url' => Url::fromRoute('comment.reply', [
             'entity_type' => $entity->getCommentedEntityTypeId(),
             'entity' => $entity->getCommentedEntityId(),
@@ -199,7 +202,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()]),
         ];
       }
@@ -211,7 +214,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 785f2b4c807eb4e1b8f4284c9f4e83a6fb2f93d6..d2d08dfc0eecc28cf286b7365d57a7d58fe40620 100644
--- a/core/modules/comment/src/CommentStatistics.php
+++ b/core/modules/comment/src/CommentStatistics.php
@@ -10,10 +10,13 @@
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\State\StateInterface;
 use Drupal\Core\Session\AccountInterface;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
 use Drupal\user\EntityOwnerInterface;
 
 class CommentStatistics implements CommentStatisticsInterface {
 
+  use StringTranslationTrait;
+
   /**
    * The current database connection.
    *
@@ -173,7 +176,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',
diff --git a/core/modules/comment/src/CommentTranslationHandler.php b/core/modules/comment/src/CommentTranslationHandler.php
index a0abe4b710ae14ada529c0ac9b5338387f8b1f4b..433d0571bc1694789080e54760fe5bc2a9c9cc2a 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/datetime/src/DateTimeViewsHelper.php b/core/modules/datetime/src/DateTimeViewsHelper.php
index 04ddf06a443c55e8314306403e9b89304260d1ce..61d959e70efdd8799c7829f4eab000430684dc61 100644
--- a/core/modules/datetime/src/DateTimeViewsHelper.php
+++ b/core/modules/datetime/src/DateTimeViewsHelper.php
@@ -4,6 +4,7 @@
 
 namespace Drupal\datetime;
 
+use Drupal\Core\StringTranslation\StringTranslationTrait;
 use Drupal\field\FieldStorageConfigInterface;
 use Drupal\views\FieldViewsDataProvider;
 
@@ -12,6 +13,8 @@
  */
 class DateTimeViewsHelper {
 
+  use StringTranslationTrait;
+
   public function __construct(
     protected readonly ?FieldViewsDataProvider $fieldViewsDataProvider,
   ) {}
@@ -51,17 +54,17 @@ public function buildViewsData(FieldStorageConfigInterface $field_storage, array
       $group = $data[$table_name][$field_storage->getName() . '_' . $column_name]['group'];
       $arguments = [
         // Argument type => help text.
-        'year' => t('Date in the form of YYYY.'),
-        'month' => t('Date in the form of MM (01 - 12).'),
-        'day' => t('Date in the form of DD (01 - 31).'),
-        'week' => t('Date in the form of WW (01 - 53).'),
-        'year_month' => t('Date in the form of YYYYMM.'),
-        'full_date' => t('Date in the form of CCYYMMDD.'),
+        'year' => $this->t('Date in the form of YYYY.'),
+        'month' => $this->t('Date in the form of MM (01 - 12).'),
+        'day' => $this->t('Date in the form of DD (01 - 31).'),
+        'week' => $this->t('Date in the form of WW (01 - 53).'),
+        'year_month' => $this->t('Date in the form of YYYYMM.'),
+        'full_date' => $this->t('Date in the form of CCYYMMDD.'),
       ];
       foreach ($arguments as $argument_type => $help_text) {
         $column_name_text = $column_name === $field_storage->getMainPropertyName() ? '' : ':' . $column_name;
         $data[$table_name][$field_storage->getName() . '_' . $column_name . '_' . $argument_type] = [
-          'title' => t('@label@column (@argument)', [
+          'title' => $this->t('@label@column (@argument)', [
             '@label' => $field_storage->getLabel(),
             '@column' => $column_name_text,
             '@argument' => $argument_type,
diff --git a/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php b/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php
index 0c834cd850c09e4cb44a09796bd8d884b9714634..6b0da585453fe6a8738ddd5bbd08a5f22f9abf41 100644
--- a/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php
+++ b/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php
@@ -14,6 +14,7 @@
 use Drupal\Core\Plugin\Context\ContextDefinition;
 use Drupal\Core\Plugin\Context\EntityContext;
 use Drupal\Core\Render\Element;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
 use Drupal\Core\StringTranslation\TranslatableMarkup;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\Entity\FieldStorageConfig;
@@ -30,6 +31,7 @@ class LayoutBuilderEntityViewDisplay extends BaseEntityViewDisplay implements La
 
   use LayoutEntityHelperTrait;
   use SectionListTrait;
+  use StringTranslationTrait;
 
   /**
    * The entity field manager.
@@ -231,7 +233,7 @@ protected function addSectionField($entity_type_id, $bundle, $field_name) {
       $field = FieldConfig::create([
         'field_storage' => $field_storage,
         'bundle' => $bundle,
-        'label' => t('Layout'),
+        'label' => $this->t('Layout'),
       ]);
       $field->setTranslatable(FALSE);
       $field->save();
diff --git a/core/modules/locale/src/StreamWrapper/TranslationsStream.php b/core/modules/locale/src/StreamWrapper/TranslationsStream.php
index dbdb85d2b38fc7d74b507e6d8f8f239d75de9d9c..980c048e290bad7f828894d31574e0a9388fb9a6 100644
--- a/core/modules/locale/src/StreamWrapper/TranslationsStream.php
+++ b/core/modules/locale/src/StreamWrapper/TranslationsStream.php
@@ -4,6 +4,7 @@
 
 use Drupal\Core\StreamWrapper\LocalStream;
 use Drupal\Core\StreamWrapper\StreamWrapperInterface;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
 
 /**
  * Defines a Drupal translations (translations://) stream wrapper class.
@@ -12,6 +13,8 @@
  */
 class TranslationsStream extends LocalStream {
 
+  use StringTranslationTrait;
+
   /**
    * {@inheritdoc}
    */
@@ -23,14 +26,14 @@ public static function getType() {
    * {@inheritdoc}
    */
   public function getName() {
-    return t('Translation files');
+    return $this->t('Translation files');
   }
 
   /**
    * {@inheritdoc}
    */
   public function getDescription() {
-    return t('Translation files');
+    return $this->t('Translation files');
   }
 
   /**
diff --git a/core/modules/mysql/src/Driver/Database/mysql/Install/Tasks.php b/core/modules/mysql/src/Driver/Database/mysql/Install/Tasks.php
index 3743235a6a86ea574612778ceafb2ff860862ba3..e6dd477fa51d4373d37442eb701a365070505a6a 100644
--- a/core/modules/mysql/src/Driver/Database/mysql/Install/Tasks.php
+++ b/core/modules/mysql/src/Driver/Database/mysql/Install/Tasks.php
@@ -5,6 +5,7 @@
 use Drupal\Core\Database\ConnectionNotDefinedException;
 use Drupal\Core\Database\Database;
 use Drupal\Core\Database\Install\Tasks as InstallTasks;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
 use Drupal\mysql\Driver\Database\mysql\Connection;
 use Drupal\Core\Database\DatabaseNotFoundException;
 
@@ -13,6 +14,8 @@
  */
 class Tasks extends InstallTasks {
 
+  use StringTranslationTrait;
+
   /**
    * Minimum required MySQL version.
    */
@@ -110,13 +113,13 @@ protected function connect() {
         catch (DatabaseNotFoundException $e) {
           // Still no dice; probably a permission issue. Raise the error to the
           // installer.
-          $this->fail(t('Database %database not found. The server reports the following message when attempting to create the database: %error.', ['%database' => $database, '%error' => $e->getMessage()]));
+          $this->fail($this->t('Database %database not found. The server reports the following message when attempting to create the database: %error.', ['%database' => $database, '%error' => $e->getMessage()]));
         }
       }
       else {
         // Database connection failed for some other reason than a non-existent
         // database.
-        $this->fail(t('Failed to connect to your database server. The server reports the following message: %error.<ul><li>Is the database server running?</li><li>Does the database exist or does the database user have sufficient privileges to create the database?</li><li>Have you entered the correct database name?</li><li>Have you entered the correct username and password?</li><li>Have you entered the correct database hostname and port number?</li></ul>', ['%error' => $e->getMessage()]));
+        $this->fail($this->t('Failed to connect to your database server. The server reports the following message: %error.<ul><li>Is the database server running?</li><li>Does the database exist or does the database user have sufficient privileges to create the database?</li><li>Have you entered the correct database name?</li><li>Have you entered the correct username and password?</li><li>Have you entered the correct database hostname and port number?</li></ul>', ['%error' => $e->getMessage()]));
         return FALSE;
       }
     }
@@ -154,7 +157,7 @@ public function getFormOptions(array $database) {
   public function ensureInnoDbAvailable() {
     $engines = Database::getConnection()->query('SHOW ENGINES')->fetchAllKeyed();
     if (isset($engines['MyISAM']) && $engines['MyISAM'] == 'DEFAULT' && !isset($engines['InnoDB'])) {
-      $this->fail(t('The MyISAM storage engine is not supported.'));
+      $this->fail($this->t('The MyISAM storage engine is not supported.'));
     }
   }
 
diff --git a/core/modules/node/src/NodeTranslationHandler.php b/core/modules/node/src/NodeTranslationHandler.php
index 244a0535a2605d1ab3f6a63bf6a7a1347f5976f5..6c802440f37922820561ac00fa29dd1c43247a53 100644
--- a/core/modules/node/src/NodeTranslationHandler.php
+++ b/core/modules/node/src/NodeTranslationHandler.php
@@ -40,7 +40,7 @@ public function entityFormAlter(array &$form, FormStateInterface $form_state, En
       }
       if (isset($status_translatable)) {
         if (isset($form['actions']['submit'])) {
-          $form['actions']['submit']['#value'] .= ' ' . ($status_translatable ? t('(this translation)') : t('(all translations)'));
+          $form['actions']['submit']['#value'] .= ' ' . ($status_translatable ? $this->t('(this translation)') : $this->t('(all translations)'));
         }
       }
     }
@@ -51,7 +51,7 @@ public function entityFormAlter(array &$form, FormStateInterface $form_state, En
    */
   protected function entityFormTitle(EntityInterface $entity) {
     $type_name = node_get_type_label($entity);
-    return t('<em>Edit @type</em> @title', ['@type' => $type_name, '@title' => $entity->label()]);
+    return $this->t('<em>Edit @type</em> @title', ['@type' => $type_name, '@title' => $entity->label()]);
   }
 
   /**
diff --git a/core/modules/node/src/NodeViewBuilder.php b/core/modules/node/src/NodeViewBuilder.php
index e9b491d21d490d6a1ee737bddb9c29ffa6849a49..f077ad75dc5314ed82f20984cd3c4e70be456dfb 100644
--- a/core/modules/node/src/NodeViewBuilder.php
+++ b/core/modules/node/src/NodeViewBuilder.php
@@ -6,6 +6,7 @@
 use Drupal\Core\Entity\EntityViewBuilder;
 use Drupal\Core\Render\Element\Link;
 use Drupal\Core\Security\TrustedCallbackInterface;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
 
 // cspell:ignore readmore
 
@@ -14,6 +15,8 @@
  */
 class NodeViewBuilder extends EntityViewBuilder implements TrustedCallbackInterface {
 
+  use StringTranslationTrait;
+
   /**
    * {@inheritdoc}
    */
@@ -47,7 +50,7 @@ public function buildComponents(array &$build, array $entities, array $displays,
       if ($display->getComponent('langcode')) {
         $build[$id]['langcode'] = [
           '#type' => 'item',
-          '#title' => t('Language'),
+          '#title' => $this->t('Language'),
           '#markup' => $entity->language()->getName(),
           '#prefix' => '<div id="field-language-display">',
           '#suffix' => '</div>',
diff --git a/core/modules/package_manager/src/Validator/EnabledExtensionsValidator.php b/core/modules/package_manager/src/Validator/EnabledExtensionsValidator.php
index 526f5a0fecb092d5010050f7066e5906c5f7e9d8..2406ca082c6838c9ed8d3d1005397db0d9e616e7 100644
--- a/core/modules/package_manager/src/Validator/EnabledExtensionsValidator.php
+++ b/core/modules/package_manager/src/Validator/EnabledExtensionsValidator.php
@@ -46,7 +46,7 @@ public function validate(PreApplyEvent $event): void {
       $extension_name = $extension->getName();
       $package = $active_packages_list->getPackageByDrupalProjectName($extension_name);
       if ($package && $stage_packages_list->getPackageByDrupalProjectName($extension_name) === NULL) {
-        $removed_project_messages[] = t("'@name' @type (provided by <code>@package</code>)", [
+        $removed_project_messages[] = $this->t("'@name' @type (provided by <code>@package</code>)", [
           '@name' => $extension_name,
           '@type' => $extension->getType(),
           '@package' => $package->name,
diff --git a/core/modules/pgsql/src/Driver/Database/pgsql/Install/Tasks.php b/core/modules/pgsql/src/Driver/Database/pgsql/Install/Tasks.php
index b21f5ea63cf4d20a80e182bb9c01e85a8ddeb8b4..6cee45efbf47907d9c3d08b71a68e59e49a17fd9 100644
--- a/core/modules/pgsql/src/Driver/Database/pgsql/Install/Tasks.php
+++ b/core/modules/pgsql/src/Driver/Database/pgsql/Install/Tasks.php
@@ -5,6 +5,7 @@
 use Drupal\Core\Database\Database;
 use Drupal\Core\Database\Install\Tasks as InstallTasks;
 use Drupal\Core\Database\DatabaseNotFoundException;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
 
 // cspell:ignore proname trgm
 
@@ -13,6 +14,8 @@
  */
 class Tasks extends InstallTasks {
 
+  use StringTranslationTrait;
+
   /**
    * Minimum required PostgreSQL version.
    *
@@ -57,7 +60,7 @@ public function __construct() {
    * {@inheritdoc}
    */
   public function name() {
-    return t('PostgreSQL');
+    return $this->t('PostgreSQL');
   }
 
   /**
@@ -109,13 +112,13 @@ protected function connect() {
         catch (DatabaseNotFoundException $e) {
           // Still no dice; probably a permission issue. Raise the error to the
           // installer.
-          $this->fail(t('Database %database not found. The server reports the following message when attempting to create the database: %error.', ['%database' => $database, '%error' => $e->getMessage()]));
+          $this->fail($this->t('Database %database not found. The server reports the following message when attempting to create the database: %error.', ['%database' => $database, '%error' => $e->getMessage()]));
         }
       }
       else {
         // Database connection failed for some other reason than a non-existent
         // database.
-        $this->fail(t('Failed to connect to your database server. The server reports the following message: %error.<ul><li>Is the database server running?</li><li>Does the database exist, and have you entered the correct database name?</li><li>Have you entered the correct username and password?</li><li>Have you entered the correct database hostname and port number?</li></ul>', ['%error' => $e->getMessage()]));
+        $this->fail($this->t('Failed to connect to your database server. The server reports the following message: %error.<ul><li>Is the database server running?</li><li>Does the database exist, and have you entered the correct database name?</li><li>Have you entered the correct username and password?</li><li>Have you entered the correct database hostname and port number?</li></ul>', ['%error' => $e->getMessage()]));
         return FALSE;
       }
     }
@@ -128,17 +131,17 @@ protected function connect() {
   protected function checkEncoding() {
     try {
       if (Database::getConnection()->query('SHOW server_encoding')->fetchField() == 'UTF8') {
-        $this->pass(t('Database is encoded in UTF-8'));
+        $this->pass($this->t('Database is encoded in UTF-8'));
       }
       else {
-        $this->fail(t('The %driver database must use %encoding encoding to work with Drupal. Recreate the database with %encoding encoding. See <a href="INSTALL.pgsql.txt">INSTALL.pgsql.txt</a> for more details.', [
+        $this->fail($this->t('The %driver database must use %encoding encoding to work with Drupal. Recreate the database with %encoding encoding. See <a href="INSTALL.pgsql.txt">INSTALL.pgsql.txt</a> for more details.', [
           '%encoding' => 'UTF8',
           '%driver' => $this->name(),
         ]));
       }
     }
     catch (\Exception) {
-      $this->fail(t('Drupal could not determine the encoding of the database was set to UTF-8'));
+      $this->fail($this->t('Drupal could not determine the encoding of the database was set to UTF-8'));
     }
   }
 
@@ -179,7 +182,7 @@ public function checkBinaryOutput() {
           '%needed_value' => 'escape',
           '@query' => $query,
         ];
-        $this->fail(t("The %setting setting is currently set to '%current_value', but needs to be '%needed_value'. Change this by running the following query: <code>@query</code>", $replacements));
+        $this->fail($this->t("The %setting setting is currently set to '%current_value', but needs to be '%needed_value'. Change this by running the following query: <code>@query</code>", $replacements));
       }
     }
   }
@@ -231,7 +234,7 @@ public function checkStandardConformingStrings() {
           '%needed_value' => 'on',
           '@query' => $query,
         ];
-        $this->fail(t("The %setting setting is currently set to '%current_value', but needs to be '%needed_value'. Change this by running the following query: <code>@query</code>", $replacements));
+        $this->fail($this->t("The %setting setting is currently set to '%current_value', but needs to be '%needed_value'. Change this by running the following query: <code>@query</code>", $replacements));
       }
     }
   }
@@ -254,17 +257,17 @@ public function checkExtensions() {
       $connection->query('CREATE EXTENSION IF NOT EXISTS pg_trgm');
 
       if ($connection->schema()->extensionExists('pg_trgm')) {
-        $this->pass(t('PostgreSQL has the pg_trgm extension enabled.'));
+        $this->pass($this->t('PostgreSQL has the pg_trgm extension enabled.'));
       }
       else {
-        $this->fail(t('The <a href=":pg_trgm">pg_trgm</a> PostgreSQL extension is not present. The extension is required by Drupal 10 to improve performance when using PostgreSQL. See <a href=":requirements">Drupal database server requirements</a> for more information.', [
+        $this->fail($this->t('The <a href=":pg_trgm">pg_trgm</a> PostgreSQL extension is not present. The extension is required by Drupal 10 to improve performance when using PostgreSQL. See <a href=":requirements">Drupal database server requirements</a> for more information.', [
           ':pg_trgm' => 'https://www.postgresql.org/docs/current/pgtrgm.html',
           ':requirements' => 'https://www.drupal.org/docs/system-requirements/database-server-requirements',
         ]));
       }
     }
     catch (\Exception $e) {
-      $this->fail(t('Drupal could not check for the pg_trgm extension: @error.', ['@error' => $e->getMessage()]));
+      $this->fail($this->t('Drupal could not check for the pg_trgm extension: @error.', ['@error' => $e->getMessage()]));
     }
   }
 
@@ -303,10 +306,10 @@ public function initializeDatabase() {
       }
       $connection->query('SELECT pg_advisory_unlock(1)');
 
-      $this->pass(t('PostgreSQL has initialized itself.'));
+      $this->pass($this->t('PostgreSQL has initialized itself.'));
     }
     catch (\Exception $e) {
-      $this->fail(t('Drupal could not be correctly setup with the existing database due to the following error: @error.', ['@error' => $e->getMessage()]));
+      $this->fail($this->t('Drupal could not be correctly setup with the existing database due to the following error: @error.', ['@error' => $e->getMessage()]));
     }
   }
 
diff --git a/core/modules/shortcut/src/ShortcutLazyBuilders.php b/core/modules/shortcut/src/ShortcutLazyBuilders.php
index c48dfdce2b2ace5d7b694f683ae7225e4ee319b5..5a6c5ccde8cd369054501ab71ba23cee0f49ce07 100644
--- a/core/modules/shortcut/src/ShortcutLazyBuilders.php
+++ b/core/modules/shortcut/src/ShortcutLazyBuilders.php
@@ -6,6 +6,7 @@
 use Drupal\Core\Render\RendererInterface;
 use Drupal\Core\Security\TrustedCallbackInterface;
 use Drupal\Core\Session\AccountInterface;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
 use Drupal\Core\Url;
 
 /**
@@ -13,6 +14,8 @@
  */
 class ShortcutLazyBuilders implements TrustedCallbackInterface {
 
+  use StringTranslationTrait;
+
   /**
    * The renderer service.
    *
@@ -60,7 +63,7 @@ public function lazyLinks(bool $show_configure_link = TRUE) {
     if ($show_configure_link && shortcut_set_edit_access($shortcut_set)->isAllowed()) {
       $configure_link = [
         '#type' => 'link',
-        '#title' => t('Edit shortcuts'),
+        '#title' => $this->t('Edit shortcuts'),
         '#url' => Url::fromRoute('entity.shortcut_set.customize_form', ['shortcut_set' => $shortcut_set->id()]),
         '#options' => ['attributes' => ['class' => ['edit-shortcuts']]],
       ];
diff --git a/core/modules/shortcut/src/ShortcutSetListBuilder.php b/core/modules/shortcut/src/ShortcutSetListBuilder.php
index e873aaea4f33de6655f7ff3af6a975c1675b84db..4500fbcf2c9717ffb1c65edf739eb4fcda0188fb 100644
--- a/core/modules/shortcut/src/ShortcutSetListBuilder.php
+++ b/core/modules/shortcut/src/ShortcutSetListBuilder.php
@@ -16,7 +16,7 @@ class ShortcutSetListBuilder extends ConfigEntityListBuilder {
    * {@inheritdoc}
    */
   public function buildHeader() {
-    $header['name'] = t('Name');
+    $header['name'] = $this->t('Name');
     return $header + parent::buildHeader();
   }
 
@@ -27,11 +27,11 @@ public function getDefaultOperations(EntityInterface $entity) {
     $operations = parent::getDefaultOperations($entity);
 
     if (isset($operations['edit'])) {
-      $operations['edit']['title'] = t('Edit shortcut set');
+      $operations['edit']['title'] = $this->t('Edit shortcut set');
     }
 
     $operations['list'] = [
-      'title' => t('List links'),
+      'title' => $this->t('List links'),
       'url' => $entity->toUrl('customize-form'),
     ];
     return $operations;
diff --git a/core/modules/sqlite/src/Driver/Database/sqlite/Install/Tasks.php b/core/modules/sqlite/src/Driver/Database/sqlite/Install/Tasks.php
index c03e6226d2c4801f43ac06d0d6705be0ad60c034..2620d1adc1e7ba1bf5a58ab09f4f03f737f4a524 100644
--- a/core/modules/sqlite/src/Driver/Database/sqlite/Install/Tasks.php
+++ b/core/modules/sqlite/src/Driver/Database/sqlite/Install/Tasks.php
@@ -3,6 +3,7 @@
 namespace Drupal\sqlite\Driver\Database\sqlite\Install;
 
 use Drupal\Core\Database\Database;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
 use Drupal\sqlite\Driver\Database\sqlite\Connection;
 use Drupal\Core\Database\DatabaseNotFoundException;
 use Drupal\Core\Database\Install\Tasks as InstallTasks;
@@ -12,6 +13,8 @@
  */
 class Tasks extends InstallTasks {
 
+  use StringTranslationTrait;
+
   /**
    * Minimum required SQLite version.
    *
@@ -30,7 +33,7 @@ class Tasks extends InstallTasks {
    * {@inheritdoc}
    */
   public function name() {
-    return t('SQLite');
+    return $this->t('SQLite');
   }
 
   /**
@@ -50,8 +53,8 @@ public function getFormOptions(array $database) {
     unset($form['username'], $form['password'], $form['advanced_options']['host'], $form['advanced_options']['port']);
 
     // Make the text more accurate for SQLite.
-    $form['database']['#title'] = t('Database file');
-    $form['database']['#description'] = t('The absolute path to the file where @drupal data will be stored. This must be writable by the web server and should exist outside of the web root.', ['@drupal' => drupal_install_profile_distribution_name()]);
+    $form['database']['#title'] = $this->t('Database file');
+    $form['database']['#description'] = $this->t('The absolute path to the file where @drupal data will be stored. This must be writable by the web server and should exist outside of the web root.', ['@drupal' => drupal_install_profile_distribution_name()]);
     $default_database = \Drupal::getContainer()->getParameter('site.path') . '/files/.ht.sqlite';
     $form['database']['#default_value'] = empty($database['database']) ? $default_database : $database['database'];
     return $form;
@@ -100,13 +103,13 @@ protected function connect() {
         catch (DatabaseNotFoundException $e) {
           // Still no dice; probably a permission issue. Raise the error to the
           // installer.
-          $this->fail(t('Failed to open or create database file %database. The database engine reports the following message when attempting to create the database: %error.', ['%database' => $database, '%error' => $e->getMessage()]));
+          $this->fail($this->t('Failed to open or create database file %database. The database engine reports the following message when attempting to create the database: %error.', ['%database' => $database, '%error' => $e->getMessage()]));
         }
       }
       else {
         // Database connection failed for some other reason than a non-existent
         // database.
-        $this->fail(t('Failed to connect to database. The database engine reports the following message: %error.<ul><li>Does the database file exist?</li><li>Does web server have permission to write to the database file?</li>Does the web server have permission to write to the directory the database file should be created in?</li></ul>', ['%error' => $e->getMessage()]));
+        $this->fail($this->t('Failed to connect to database. The database engine reports the following message: %error.<ul><li>Does the database file exist?</li><li>Does web server have permission to write to the database file?</li>Does the web server have permission to write to the directory the database file should be created in?</li></ul>', ['%error' => $e->getMessage()]));
         return FALSE;
       }
     }
diff --git a/core/modules/system/src/DateFormatListBuilder.php b/core/modules/system/src/DateFormatListBuilder.php
index ad2c2223f3eeefd85ea4e8fe6f721713edf3fad8..5385ad37614e4305199c6e56fdc4e138f7b29ecc 100644
--- a/core/modules/system/src/DateFormatListBuilder.php
+++ b/core/modules/system/src/DateFormatListBuilder.php
@@ -8,6 +8,7 @@
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\EntityStorageInterface;
 use Drupal\Core\Entity\EntityTypeInterface;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
@@ -17,6 +18,8 @@
  */
 class DateFormatListBuilder extends ConfigEntityListBuilder {
 
+  use StringTranslationTrait;
+
   /**
    * Constructs a new DateFormatListBuilder object.
    *
@@ -54,8 +57,8 @@ public static function createInstance(ContainerInterface $container, EntityTypeI
    * {@inheritdoc}
    */
   public function buildHeader() {
-    $header['label'] = t('Name');
-    $header['pattern'] = t('Pattern');
+    $header['label'] = $this->t('Name');
+    $header['pattern'] = $this->t('Pattern');
     return $header + parent::buildHeader();
   }
 
diff --git a/core/modules/system/src/Form/DateFormatEditForm.php b/core/modules/system/src/Form/DateFormatEditForm.php
index 17708295740785cffb48333587afd95098a3863f..4c0bb1c9082b1b966c206342b68710fffba82306 100644
--- a/core/modules/system/src/Form/DateFormatEditForm.php
+++ b/core/modules/system/src/Form/DateFormatEditForm.php
@@ -6,6 +6,7 @@
 use Drupal\Core\Config\Entity\ConfigEntityStorageInterface;
 use Drupal\Core\Datetime\DateFormatterInterface;
 use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
@@ -15,6 +16,8 @@
  */
 class DateFormatEditForm extends DateFormatFormBase {
 
+  use StringTranslationTrait;
+
   /**
    * Constructs a DateFormatEditForm object.
    *
@@ -50,7 +53,7 @@ public static function create(ContainerInterface $container) {
   public function form(array $form, FormStateInterface $form_state) {
     $form = parent::form($form, $form_state);
 
-    $now = t('Displayed as %date', ['%date' => $this->dateFormatter->format($this->time->getRequestTime(), $this->entity->id())]);
+    $now = $this->t('Displayed as %date', ['%date' => $this->dateFormatter->format($this->time->getRequestTime(), $this->entity->id())]);
     $form['date_format_pattern']['#field_suffix'] = ' <small data-drupal-date-formatter="preview">' . $now . '</small>';
     $form['date_format_pattern']['#default_value'] = $this->entity->getPattern();
 
diff --git a/core/modules/system/src/SystemManager.php b/core/modules/system/src/SystemManager.php
index 44305e80ef3044e5fc6a3666ab0ed35b9c42c1d7..5534e70147b444230976c158a6fe9bcd83e22f52 100644
--- a/core/modules/system/src/SystemManager.php
+++ b/core/modules/system/src/SystemManager.php
@@ -7,6 +7,7 @@
 use Drupal\Core\Menu\MenuLinkInterface;
 use Drupal\Core\Menu\MenuTreeParameters;
 use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
 use Symfony\Component\HttpFoundation\RequestStack;
 
 /**
@@ -14,6 +15,8 @@
  */
 class SystemManager {
 
+  use StringTranslationTrait;
+
   /**
    * Module handler service.
    *
@@ -168,7 +171,7 @@ public function getBlockContents() {
     }
     else {
       $output = [
-        '#markup' => t('You do not have any administrative items.'),
+        '#markup' => $this->t('You do not have any administrative items.'),
       ];
     }
     return $output;
diff --git a/core/modules/taxonomy/src/Form/OverviewTerms.php b/core/modules/taxonomy/src/Form/OverviewTerms.php
index 5fa49755de33e90a1a3a9281e49f5d56e86b3c73..6a1bba9d5be43b489147ae0483b0eeca101a9252 100644
--- a/core/modules/taxonomy/src/Form/OverviewTerms.php
+++ b/core/modules/taxonomy/src/Form/OverviewTerms.php
@@ -357,7 +357,7 @@ public function buildForm(array $form, FormStateInterface $form_state, ?Vocabula
       ];
       $form['terms'][$key]['status'] = [
         '#type' => 'item',
-        '#markup' => ($term->isPublished()) ? t('Published') : t('Unpublished'),
+        '#markup' => ($term->isPublished()) ? $this->t('Published') : $this->t('Unpublished'),
       ];
 
       // Add a special class for terms with pending revision so we can highlight
diff --git a/core/modules/taxonomy/src/TermViewsData.php b/core/modules/taxonomy/src/TermViewsData.php
index b997aecc3b3e5661a2a4f445001bf702bef0b989..7ca182d96938b8d7238b9604a227ec59cc0d4e07 100644
--- a/core/modules/taxonomy/src/TermViewsData.php
+++ b/core/modules/taxonomy/src/TermViewsData.php
@@ -66,11 +66,11 @@ public function getViewsData() {
     ];
 
     $data['taxonomy_term_field_data']['vid']['help'] = $this->t('Filter the results of "Taxonomy: Term" to a particular vocabulary.');
-    $data['taxonomy_term_field_data']['vid']['field']['help'] = t('The vocabulary name.');
+    $data['taxonomy_term_field_data']['vid']['field']['help'] = $this->t('The vocabulary name.');
     $data['taxonomy_term_field_data']['vid']['argument']['id'] = 'vocabulary_vid';
 
-    $data['taxonomy_term_field_data']['vid']['sort']['title'] = t('Vocabulary ID');
-    $data['taxonomy_term_field_data']['vid']['sort']['help'] = t('The raw vocabulary ID.');
+    $data['taxonomy_term_field_data']['vid']['sort']['title'] = $this->t('Vocabulary ID');
+    $data['taxonomy_term_field_data']['vid']['sort']['help'] = $this->t('The raw vocabulary ID.');
 
     $data['taxonomy_term_field_data']['name']['field']['id'] = 'term_name';
     $data['taxonomy_term_field_data']['name']['argument']['many to one'] = TRUE;
diff --git a/core/modules/update/src/Controller/UpdateController.php b/core/modules/update/src/Controller/UpdateController.php
index a67eba3f6051e7c8138204f4131c1a60ff65b7df..bcbd7eb851a95cd7e09142edad6c78099eebb54d 100644
--- a/core/modules/update/src/Controller/UpdateController.php
+++ b/core/modules/update/src/Controller/UpdateController.php
@@ -79,7 +79,7 @@ public function updateStatusManually() {
     $batch_builder = (new BatchBuilder())
       ->setTitle($this->t('Checking available update data'))
       ->addOperation([$this->updateManager, 'fetchDataBatch'], [])
-      ->setProgressMessage(t('Trying to check available update data ...'))
+      ->setProgressMessage($this->t('Trying to check available update data ...'))
       ->setErrorMessage($this->t('Error checking available update data.'))
       ->setFinishCallback('update_fetch_data_finished');
     batch_set($batch_builder->toArray());
diff --git a/core/modules/views/src/Analyzer.php b/core/modules/views/src/Analyzer.php
index 98089926f8b35b34a5f260ce5dd275bfc5ba494a..15aea75366cf5289064ecc71b31c6a987b7b3f8a 100644
--- a/core/modules/views/src/Analyzer.php
+++ b/core/modules/views/src/Analyzer.php
@@ -3,6 +3,7 @@
 namespace Drupal\views;
 
 use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
 
 /**
  * View analyzer plugin manager.
@@ -16,6 +17,8 @@
  */
 class Analyzer {
 
+  use StringTranslationTrait;
+
   /**
    * A module handler that invokes the 'views_analyze' hook.
    *
@@ -59,7 +62,7 @@ public function getMessages(ViewExecutable $view) {
    */
   public function formatMessages(array $messages) {
     if (empty($messages)) {
-      $messages = [static::formatMessage(t('View analysis can find nothing to report.'), 'ok')];
+      $messages = [static::formatMessage($this->t('View analysis can find nothing to report.'), 'ok')];
     }
 
     $types = ['ok' => [], 'warning' => [], 'error' => []];
diff --git a/core/modules/views/src/DisplayPluginCollection.php b/core/modules/views/src/DisplayPluginCollection.php
index 137ba62f2516ed75554f0c139f9640c9959dc659..5edb711a3db03238cdd82447de6cde33cfcd6880 100644
--- a/core/modules/views/src/DisplayPluginCollection.php
+++ b/core/modules/views/src/DisplayPluginCollection.php
@@ -5,12 +5,15 @@
 use Drupal\Component\Plugin\Exception\PluginException;
 use Drupal\Component\Plugin\PluginManagerInterface;
 use Drupal\Core\Plugin\DefaultLazyPluginCollection;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
 
 /**
  * A class which wraps the displays of a view so you can lazy-initialize them.
  */
 class DisplayPluginCollection extends DefaultLazyPluginCollection {
 
+  use StringTranslationTrait;
+
   /**
    * Stores a reference to the view which has this displays attached.
    *
@@ -81,7 +84,7 @@ protected function initializePlugin($display_id) {
     // display plugin isn't found.
     catch (PluginException $e) {
       $message = $e->getMessage();
-      \Drupal::messenger()->addWarning(t('@message', ['@message' => $message]));
+      \Drupal::messenger()->addWarning($this->t('@message', ['@message' => $message]));
     }
 
     // If no plugin instance has been created, return NULL.
diff --git a/core/modules/views/src/Entity/View.php b/core/modules/views/src/Entity/View.php
index 3f13b6de9cfab582848c48cb0facf99f7c4e801e..cd1b2a0a42e1bea1feb48a065a71517bd48f24a7 100644
--- a/core/modules/views/src/Entity/View.php
+++ b/core/modules/views/src/Entity/View.php
@@ -3,6 +3,7 @@
 namespace Drupal\views\Entity;
 
 use Drupal\Core\Entity\Attribute\ConfigEntityType;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
 use Drupal\Core\StringTranslation\TranslatableMarkup;
 use Drupal\Component\Utility\NestedArray;
 use Drupal\Core\Cache\Cache;
@@ -45,6 +46,8 @@
 )]
 class View extends ConfigEntityBase implements ViewEntityInterface {
 
+  use StringTranslationTrait;
+
   /**
    * The name of the base table this view will use.
    *
@@ -153,7 +156,7 @@ public function addDisplay($plugin_id = 'page', $title = NULL, $id = NULL) {
     $plugin = Views::pluginManager('display')->getDefinition($plugin_id);
 
     if (empty($plugin)) {
-      $plugin['title'] = t('Broken');
+      $plugin['title'] = $this->t('Broken');
     }
 
     if (empty($id)) {
diff --git a/core/modules/views/src/FieldViewsDataProvider.php b/core/modules/views/src/FieldViewsDataProvider.php
index 7a79e242d4998f38107c566f20e02a5317a38a85..c0b9d50b2d9cd04a91102731da9c5901b66e9e9f 100644
--- a/core/modules/views/src/FieldViewsDataProvider.php
+++ b/core/modules/views/src/FieldViewsDataProvider.php
@@ -8,6 +8,7 @@
 use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
 use Drupal\Core\Field\FieldTypePluginManagerInterface;
 use Drupal\Core\Render\Markup;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
 use Drupal\field\Entity\FieldConfig;
 use Drupal\field\FieldStorageConfigInterface;
 
@@ -16,6 +17,8 @@
  */
 class FieldViewsDataProvider {
 
+  use StringTranslationTrait;
+
   public function __construct(
     protected readonly EntityTypeManager $entityTypeManager,
     protected readonly FieldTypePluginManagerInterface $fieldTypePluginManager,
@@ -254,7 +257,7 @@ public function defaultFieldImplementation(FieldStorageConfigInterface $field_st
         $field_alias = $field_name;
       }
       else {
-        $group = t('@group (historical data)', ['@group' => $group_name]);
+        $group = $this->t('@group (historical data)', ['@group' => $group_name]);
         $field_alias = $field_name . '__revision_id';
       }
 
@@ -262,7 +265,7 @@ public function defaultFieldImplementation(FieldStorageConfigInterface $field_st
         'group' => $group,
         'title' => $label,
         'title short' => $label,
-        'help' => t('Appears in: @bundles.', ['@bundles' => implode(', ', $bundles_names)]),
+        'help' => $this->t('Appears in: @bundles.', ['@bundles' => implode(', ', $bundles_names)]),
       ];
 
       // Go through and create a list of aliases for all possible combinations of
@@ -276,19 +279,19 @@ public function defaultFieldImplementation(FieldStorageConfigInterface $field_st
               'base' => $base_table,
               'group' => $group_name,
               'title' => $label_name,
-              'help' => t('This is an alias of @group: @field.', ['@group' => $group_name, '@field' => $label]),
+              'help' => $this->t('This is an alias of @group: @field.', ['@group' => $group_name, '@field' => $label]),
             ];
-            $also_known[] = t('@group: @field', ['@group' => $group_name, '@field' => $label_name]);
+            $also_known[] = $this->t('@group: @field', ['@group' => $group_name, '@field' => $label_name]);
           }
         }
         elseif ($supports_revisions && $label != $label_name) {
           $aliases[] = [
             'base' => $table,
-            'group' => t('@group (historical data)', ['@group' => $group_name]),
+            'group' => $this->t('@group (historical data)', ['@group' => $group_name]),
             'title' => $label_name,
-            'help' => t('This is an alias of @group: @field.', ['@group' => $group_name, '@field' => $label]),
+            'help' => $this->t('This is an alias of @group: @field.', ['@group' => $group_name, '@field' => $label]),
           ];
-          $also_known[] = t('@group (historical data): @field', ['@group' => $group_name, '@field' => $label_name]);
+          $also_known[] = $this->t('@group (historical data): @field', ['@group' => $group_name, '@field' => $label_name]);
         }
       }
       if ($aliases) {
@@ -302,7 +305,7 @@ public function defaultFieldImplementation(FieldStorageConfigInterface $field_st
         // Considering the dual use of this help data (both as metadata and as
         // help text), other patterns such as use of #markup would not be correct
         // here.
-        $data[$table_alias][$field_alias]['help'] = Markup::create($data[$table_alias][$field_alias]['help'] . ' ' . t('Also known as:') . ' ' . implode(', ', $also_known));
+        $data[$table_alias][$field_alias]['help'] = Markup::create($data[$table_alias][$field_alias]['help'] . ' ' . $this->t('Also known as:') . ' ' . implode(', ', $also_known));
       }
 
       $keys = array_keys($field_columns);
@@ -353,12 +356,12 @@ public function defaultFieldImplementation(FieldStorageConfigInterface $field_st
       }
 
       if (count($field_columns) == 1 || $column == 'value') {
-        $title = t('@label (@name)', ['@label' => $label, '@name' => $field_name]);
+        $title = $this->t('@label (@name)', ['@label' => $label, '@name' => $field_name]);
         $title_short = $label;
       }
       else {
-        $title = t('@label (@name:@column)', ['@label' => $label, '@name' => $field_name, '@column' => $column]);
-        $title_short = t('@label:@column', ['@label' => $label, '@column' => $column]);
+        $title = $this->t('@label (@name:@column)', ['@label' => $label, '@name' => $field_name, '@column' => $column]);
+        $title_short = $this->t('@label:@column', ['@label' => $label, '@column' => $column]);
       }
 
       // Expose data for the property.
@@ -370,7 +373,7 @@ public function defaultFieldImplementation(FieldStorageConfigInterface $field_st
           $group = $group_name;
         }
         else {
-          $group = t('@group (historical data)', ['@group' => $group_name]);
+          $group = $this->t('@group (historical data)', ['@group' => $group_name]);
         }
         $column_real_name = $table_mapping->getFieldColumnName($field_storage, $column);
 
@@ -381,7 +384,7 @@ public function defaultFieldImplementation(FieldStorageConfigInterface $field_st
           'group' => $group,
           'title' => $title,
           'title short' => $title_short,
-          'help' => t('Appears in: @bundles.', ['@bundles' => implode(', ', $bundles_names)]),
+          'help' => $this->t('Appears in: @bundles.', ['@bundles' => implode(', ', $bundles_names)]),
         ];
 
         // Go through and create a list of aliases for all possible combinations of
@@ -391,17 +394,17 @@ public function defaultFieldImplementation(FieldStorageConfigInterface $field_st
         foreach ($all_labels as $label_name => $true) {
           if ($label != $label_name) {
             if (count($field_columns) == 1 || $column == 'value') {
-              $alias_title = t('@label (@name)', ['@label' => $label_name, '@name' => $field_name]);
+              $alias_title = $this->t('@label (@name)', ['@label' => $label_name, '@name' => $field_name]);
             }
             else {
-              $alias_title = t('@label (@name:@column)', ['@label' => $label_name, '@name' => $field_name, '@column' => $column]);
+              $alias_title = $this->t('@label (@name:@column)', ['@label' => $label_name, '@name' => $field_name, '@column' => $column]);
             }
             $aliases[] = [
               'group' => $group_name,
               'title' => $alias_title,
-              'help' => t('This is an alias of @group: @field.', ['@group' => $group_name, '@field' => $title]),
+              'help' => $this->t('This is an alias of @group: @field.', ['@group' => $group_name, '@field' => $title]),
             ];
-            $also_known[] = t('@group: @field', ['@group' => $group_name, '@field' => $title]);
+            $also_known[] = $this->t('@group: @field', ['@group' => $group_name, '@field' => $title]);
           }
         }
         if ($aliases) {
@@ -415,7 +418,7 @@ public function defaultFieldImplementation(FieldStorageConfigInterface $field_st
           // Considering the dual use of this help data (both as metadata and as
           // help text), other patterns such as use of #markup would not be
           // correct here.
-          $data[$table_alias][$column_real_name]['help'] = Markup::create($data[$table_alias][$column_real_name]['help'] . ' ' . t('Also known as:') . ' ' . implode(', ', $also_known));
+          $data[$table_alias][$column_real_name]['help'] = Markup::create($data[$table_alias][$column_real_name]['help'] . ' ' . $this->t('Also known as:') . ' ' . implode(', ', $also_known));
         }
 
         $data[$table_alias][$column_real_name]['argument'] = [
@@ -425,7 +428,7 @@ public function defaultFieldImplementation(FieldStorageConfigInterface $field_st
           'additional fields' => $additional_fields,
           'field_name' => $field_name,
           'entity_type' => $entity_type_id,
-          'empty field name' => t('- No value -'),
+          'empty field name' => $this->t('- No value -'),
         ];
         $data[$table_alias][$column_real_name]['filter'] = [
           'field' => $column_real_name,
@@ -454,14 +457,14 @@ public function defaultFieldImplementation(FieldStorageConfigInterface $field_st
 
         // Expose additional delta column for multiple value fields.
         if ($field_storage->isMultiple()) {
-          $title_delta = t('@label (@name:delta)', ['@label' => $label, '@name' => $field_name]);
-          $title_short_delta = t('@label:delta', ['@label' => $label]);
+          $title_delta = $this->t('@label (@name:delta)', ['@label' => $label, '@name' => $field_name]);
+          $title_short_delta = $this->t('@label:delta', ['@label' => $label]);
 
           $data[$table_alias]['delta'] = [
             'group' => $group,
             'title' => $title_delta,
             'title short' => $title_short_delta,
-            'help' => t('Delta - Appears in: @bundles.', ['@bundles' => implode(', ', $bundles_names)]),
+            'help' => $this->t('Delta - Appears in: @bundles.', ['@bundles' => implode(', ', $bundles_names)]),
           ];
           $data[$table_alias]['delta']['field'] = [
             'id' => 'numeric',
@@ -471,7 +474,7 @@ public function defaultFieldImplementation(FieldStorageConfigInterface $field_st
             'table' => $table,
             'id' => 'numeric',
             'additional fields' => $additional_fields,
-            'empty field name' => t('- No value -'),
+            'empty field name' => $this->t('- No value -'),
             'field_name' => $field_name,
             'entity_type' => $entity_type_id,
           ];
diff --git a/core/modules/views/src/ManyToOneHelper.php b/core/modules/views/src/ManyToOneHelper.php
index d8fcb3e488cf9cda15b05e61397d99caa412bfd9..fe19c75ca255ea021660ef9aeb806baef20e60c5 100644
--- a/core/modules/views/src/ManyToOneHelper.php
+++ b/core/modules/views/src/ManyToOneHelper.php
@@ -3,6 +3,7 @@
 namespace Drupal\views;
 
 use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
 use Drupal\views\Plugin\views\HandlerBase;
 use Drupal\views\Plugin\views\ViewsHandlerInterface;
 
@@ -21,6 +22,8 @@
  */
 class ManyToOneHelper {
 
+  use StringTranslationTrait;
+
   /**
    * Should the field use formula or alias.
    *
@@ -46,8 +49,8 @@ public static function defineOptions(&$options) {
   public function buildOptionsForm(&$form, FormStateInterface $form_state) {
     $form['reduce_duplicates'] = [
       '#type' => 'checkbox',
-      '#title' => t('Reduce duplicates'),
-      '#description' => t("This filter can cause items that have more than one of the selected options to appear as duplicate results. If this filter causes duplicate results to occur, this checkbox can reduce those duplicates; however, the more terms it has to search for, the less performant the query will be, so use this with caution. Shouldn't be set on single-value fields, as it may cause values to disappear from display, if used on an incompatible field."),
+      '#title' => $this->t('Reduce duplicates'),
+      '#description' => $this->t("This filter can cause items that have more than one of the selected options to appear as duplicate results. If this filter causes duplicate results to occur, this checkbox can reduce those duplicates; however, the more terms it has to search for, the less performant the query will be, so use this with caution. Shouldn't be set on single-value fields, as it may cause values to disappear from display, if used on an incompatible field."),
       '#default_value' => !empty($this->handler->options['reduce_duplicates']),
       '#weight' => 4,
     ];
diff --git a/core/modules/views_ui/src/ViewUI.php b/core/modules/views_ui/src/ViewUI.php
index 8f91cf1e8b10adfd31da88ea95cc0051cdd545eb..46842e0a85f873a08718ad60be81633f27d4ae6a 100644
--- a/core/modules/views_ui/src/ViewUI.php
+++ b/core/modules/views_ui/src/ViewUI.php
@@ -8,6 +8,7 @@
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Link;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
 use Drupal\Core\TempStore\Lock;
 use Drupal\views\Controller\ViewAjaxController;
 use Drupal\views\Views;
@@ -28,6 +29,8 @@
 #[\AllowDynamicProperties]
 class ViewUI implements ViewEntityInterface {
 
+  use StringTranslationTrait;
+
   /**
    * Indicates if a view is currently being edited.
    *
@@ -294,11 +297,11 @@ public function getStandardButtons(&$form, FormStateInterface $form_state, $form
     ];
 
     if (empty($name)) {
-      $name = t('Apply');
+      $name = $this->t('Apply');
       if (!empty($this->stack) && count($this->stack) > 1) {
-        $name = t('Apply and continue');
+        $name = $this->t('Apply and continue');
       }
-      $names = [t('Apply'), t('Apply and continue')];
+      $names = [$this->t('Apply'), $this->t('Apply and continue')];
     }
 
     // Forms that are purely informational set an ok_button flag, so we know not
@@ -337,7 +340,7 @@ public function getStandardButtons(&$form, FormStateInterface $form_state, $form
     $cancel_submit = function_exists($form_id . '_cancel') ? $form_id . '_cancel' : [$this, 'standardCancel'];
     $form['actions']['cancel'] = [
       '#type' => 'submit',
-      '#value' => !$form_state->get('ok_button') ? t('Cancel') : t('Ok'),
+      '#value' => !$form_state->get('ok_button') ? $this->t('Cancel') : $this->t('Ok'),
       '#submit' => [$cancel_submit],
       '#validate' => [],
       '#limit_validation_errors' => [],
@@ -567,7 +570,7 @@ public function renderPreview($display_id, $args = []) {
 
       if (!$executable->setDisplay($display_id)) {
         return [
-          '#markup' => t('Invalid display id @display', ['@display' => $display_id]),
+          '#markup' => $this->t('Invalid display id @display', ['@display' => $display_id]),
         ];
       }
 
@@ -667,14 +670,14 @@ public function renderPreview($display_id, $args = []) {
             if (!empty($this->additionalQueries)) {
               $queries[] = [
                 '#prefix' => '<strong>',
-                '#markup' => t('These queries were run during view rendering:'),
+                '#markup' => $this->t('These queries were run during view rendering:'),
                 '#suffix' => '</strong>',
               ];
               foreach ($this->additionalQueries as $query) {
                 $query_string = strtr($query['query'], $query['args']);
                 $queries[] = [
                   '#prefix' => "\n",
-                  '#markup' => t('[@time ms] @query', ['@time' => round($query['time'] * 100000, 1) / 100000.0, '@query' => $query_string]),
+                  '#markup' => $this->t('[@time ms] @query', ['@time' => round($query['time'] * 100000, 1) / 100000.0, '@query' => $query_string]),
                 ];
               }
 
@@ -716,13 +719,13 @@ public function renderPreview($display_id, $args = []) {
               $path = Link::fromTextAndUrl($path->toString(), $path)->toString();
             }
             else {
-              $path = t('This display has no path.');
+              $path = $this->t('This display has no path.');
             }
             $rows['query'][] = [
               [
                 'data' => [
                   '#prefix' => '<strong>',
-                  '#markup' => t('Path'),
+                  '#markup' => $this->t('Path'),
                   '#suffix' => '</strong>',
                 ],
               ],
@@ -741,7 +744,7 @@ public function renderPreview($display_id, $args = []) {
                   '#template' => "<strong>{% trans 'Query build time' %}</strong>",
                 ],
               ],
-              t('@time ms', ['@time' => intval($executable->build_time * 100000) / 100]),
+              $this->t('@time ms', ['@time' => intval($executable->build_time * 100000) / 100]),
             ];
 
             $rows['statistics'][] = [
@@ -751,7 +754,7 @@ public function renderPreview($display_id, $args = []) {
                   '#template' => "<strong>{% trans 'Query execute time' %}</strong>",
                 ],
               ],
-              t('@time ms', ['@time' => intval($executable->execute_time * 100000) / 100]),
+              $this->t('@time ms', ['@time' => intval($executable->execute_time * 100000) / 100]),
             ];
 
             $rows['statistics'][] = [
@@ -761,7 +764,7 @@ public function renderPreview($display_id, $args = []) {
                   '#template' => "<strong>{% trans 'View render time' %}</strong>",
                 ],
               ],
-              t('@time ms', ['@time' => intval($this->render_time * 100) / 100]),
+              $this->t('@time ms', ['@time' => intval($this->render_time * 100) / 100]),
             ];
           }
           \Drupal::moduleHandler()->alter('views_preview_info', $rows, $executable);
@@ -774,13 +777,13 @@ public function renderPreview($display_id, $args = []) {
               [
                 'data' => [
                   '#prefix' => '<strong>',
-                  '#markup' => t('Query'),
+                  '#markup' => $this->t('Query'),
                   '#suffix' => '</strong>',
                 ],
               ],
               [
                 'data' => [
-                  '#markup' => t('No query was run'),
+                  '#markup' => $this->t('No query was run'),
                 ],
               ],
             ];
@@ -790,13 +793,13 @@ public function renderPreview($display_id, $args = []) {
               [
                 'data' => [
                   '#prefix' => '<strong>',
-                  '#markup' => t('Query'),
+                  '#markup' => $this->t('Query'),
                   '#suffix' => '</strong>',
                 ],
               ],
               [
                 'data' => [
-                  '#markup' => t('No query was run'),
+                  '#markup' => $this->t('No query was run'),
                 ],
               ],
             ];
@@ -810,7 +813,7 @@ public function renderPreview($display_id, $args = []) {
           \Drupal::messenger()->addError($error);
         }
       }
-      $preview = ['#markup' => t('Unable to preview due to validation errors.')];
+      $preview = ['#markup' => $this->t('Unable to preview due to validation errors.')];
     }
 
     // Assemble the preview, the query info, and the query statistics in the
@@ -876,7 +879,7 @@ public function getFormProgress() {
    */
   public function cacheSet() {
     if ($this->isLocked()) {
-      \Drupal::messenger()->addError(t('Changes cannot be made to a locked view.'));
+      \Drupal::messenger()->addError($this->t('Changes cannot be made to a locked view.'));
       return;
     }
 
diff --git a/core/phpcs.xml.dist b/core/phpcs.xml.dist
index f9a5812185cb1a851d7dbf7c439c493bef073725..facef2adf13a4112c95e52d49bf4d9c9b22f4d5d 100644
--- a/core/phpcs.xml.dist
+++ b/core/phpcs.xml.dist
@@ -183,6 +183,8 @@
     <include-pattern>*/ListBuilder/*</include-pattern>
     <include-pattern>*/tests/*</include-pattern>
     <include-pattern>./core/lib/*</include-pattern>
+    <include-pattern>./core/modules/*</include-pattern>
+    <exclude-pattern>./core/modules/*/Hook/*</exclude-pattern>
   </rule>
 
   <!-- Generic sniffs -->