diff --git a/src/Form/RerouteEmailSettings.php b/src/Form/RerouteEmailSettings.php
index ff1304f..93eaf40 100644
--- a/src/Form/RerouteEmailSettings.php
+++ b/src/Form/RerouteEmailSettings.php
@@ -6,6 +6,7 @@ use Drupal\Core\Form\ConfigFormBase;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Url;
 use Drupal\Core\Config\Config;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
 
 class RerouteEmailSettings extends ConfigFormBase {
 
@@ -97,7 +98,7 @@ class RerouteEmailSettings extends ConfigFormBase {
       $addresslist = preg_split(REROUTE_EMAIL_EMAIL_SPLIT_RE, $form_state->getValue(['reroute_email_address']), -1, PREG_SPLIT_NO_EMPTY);
       foreach ($addresslist as $address) {
         if (!valid_email_address($address)) {
-          $form_state->setErrorByName('reroute_email_address', t('@address is not a valid email address', [
+          $form_state->setErrorByName('reroute_email_address',  $this->t('@address is not a valid email address', [
             '@address' => $address
           ]));
         }
diff --git a/src/Form/RerouteEmailTestEmailForm.php b/src/Form/RerouteEmailTestEmailForm.php
index 81c3609..55473c9 100644
--- a/src/Form/RerouteEmailTestEmailForm.php
+++ b/src/Form/RerouteEmailTestEmailForm.php
@@ -3,6 +3,7 @@ namespace Drupal\reroute_email\Form;
 
 use Drupal\Core\Form\FormBase;
 use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
 
 class RerouteEmailTestEmailForm extends FormBase {
 
@@ -17,33 +18,33 @@ class RerouteEmailTestEmailForm extends FormBase {
     return [
       'addresses' => [
         '#type' => 'fieldset',
-        '#description' => t('Email addresses are not validated: any valid or invalid email address format could be submitted.'),
+        '#description' => $this->t('Email addresses are not validated: any valid or invalid email address format could be submitted.'),
         'to' => [
           '#type' => 'textfield',
-          '#title' => t('To'),
+          '#title' => $this->t('To'),
           '#required' => TRUE,
         ],
         'cc' => [
           '#type' => 'textfield',
-          '#title' => t('Cc'),
+          '#title' => $this->t('Cc'),
         ],
         'bcc' => [
           '#type' => 'textfield',
-          '#title' => t('Bcc'),
+          '#title' => $this->t('Bcc'),
         ],
       ],
       'subject' => [
         '#type' => 'textfield',
-        '#title' => t('Subject'),
-        '#default_value' => t('Reroute Email Test'),
+        '#title' => $this->t('Subject'),
+        '#default_value' => $this->t('Reroute Email Test'),
       ],
       'body' => [
         '#type' => 'textarea',
-        '#title' => t('Body'),
+        '#title' => $this->t('Body'),
       ],
       'submit' => [
         '#type' => 'submit',
-        '#value' => t('Send email'),
+        '#value' => $this->t('Send email'),
       ],
     ];
   }
@@ -60,7 +61,7 @@ class RerouteEmailTestEmailForm extends FormBase {
     $message =  \Drupal::service('plugin.manager.mail')->mail('reroute_email', 'test_email_form', $to, $langcode, $params, $from);
 
     if (!empty($message['result'])) {
-      drupal_set_message(t("Test email submitted for delivery from test form."));
+      drupal_set_message($this->t("Test email submitted for delivery from test form."));
     }
   }
 
diff --git a/src/Tests/ContactTest.php b/src/Tests/ContactTest.php
index cda072a..d356204 100644
--- a/src/Tests/ContactTest.php
+++ b/src/Tests/ContactTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\reroute_email\Tests;
 
 use Drupal\reroute_email\RerouteEmailTestBase;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
 
 /**
  * Test Reroute Email module's ability to reroute mail sent from the Contact module form.
@@ -53,7 +54,7 @@ class ContactTest extends RerouteEmailTestBase {
     $this->configureRerouteEmail();
 
     // Configure the contact settings to send to $original_destination.
-    $this->drupalPostForm('admin/structure/contact/manage/feedback', array('recipients' => $this->originalDestination), t('Save'));
+    $this->drupalPostForm('admin/structure/contact/manage/feedback', array('recipients' => $this->originalDestination), $this->t('Save'));
 
     // Go to the contact page and send an email.
     $post = array('subject[0][value]' => "Test test test", 'message[0][value]' => 'This is a test');
@@ -64,7 +65,7 @@ class ContactTest extends RerouteEmailTestBase {
     $mails = $this->drupalGetMails();
 
     $mail = end($mails);
-    $this->assertMail('to', $this->rerouteDestination, t("Email was rerouted to @address", array('@address' => $this->rerouteDestination)));
+    $this->assertMail('to', $this->rerouteDestination, $this->t("Email was rerouted to @address", array('@address' => $this->rerouteDestination)));
 
     // Check if original destination email address is in rerouted email body.
     $this->assertOriginallyTo($mail['body'], 'Found the correct "Originally to" line in the body');
@@ -76,11 +77,11 @@ class ContactTest extends RerouteEmailTestBase {
     $this->configureRerouteEmail("{$this->rerouteDestination}, $additional_destination");
 
     // Configure the contact settings to point to the additional recipient.
-    $this->drupalPostForm('admin/structure/contact/manage/feedback', array('recipients' => $additional_destination), t('Save'));
+    $this->drupalPostForm('admin/structure/contact/manage/feedback', array('recipients' => $additional_destination), $this->t('Save'));
 
     // Go to the contact page and send an email.
     $post = array('subject[0][value]' => "Test test test", 'message[0][value]' => 'This is a test');
-    $this->drupalPostForm("contact", $post, t("Send message"));
+    $this->drupalPostForm("contact", $post, $this->t("Send message"));
     $this->assertText($this->confirmation_message);
     $this->assertMail('to', $additional_destination, 'Email was not rerouted because destination was in whitelist');
 
@@ -89,23 +90,23 @@ class ContactTest extends RerouteEmailTestBase {
     $this->configureRerouteEmail(NULL, FALSE);
 
     // Set the contact form to send to original_destination.
-    $this->drupalPostForm('admin/structure/contact/manage/feedback', array('recipients' => $this->originalDestination), t('Save'));
+    $this->drupalPostForm('admin/structure/contact/manage/feedback', array('recipients' => $this->originalDestination), $this->t('Save'));
     // Go to the contact page and send an email.
     $post = array('subject[0][value]' => "Test test test", 'message[0][value]' => 'This is a test');
-    $this->drupalPostForm("contact", $post, t("Send message"));
+    $this->drupalPostForm("contact", $post, $this->t("Send message"));
     $this->assertText($this->confirmation_message);
     $mails = $this->drupalGetMails();
     $mail = end($mails);
     // Mail should not be rerouted - should go to $original_destination.
     $this->assertMail('to', $this->originalDestination, 'Mail not rerouted - sent to original destination.');
-    $this->verbose(t("Email 'to' was: <pre>@mail_to</pre>", array('@mail_to' => $mail['to'])));
+    $this->verbose($this->t("Email 'to' was: <pre>@mail_to</pre>", array('@mail_to' => $mail['to'])));
 
     // Configure to reroute without body injection.
     $this->configureRerouteEmail(NULL, TRUE, FALSE);
 
     // Go to the contact page and send an email.
     $post = array('subject[0][value]' => "Test test test", 'message[0][value]' => 'This is a test');
-    $this->drupalPostForm("contact", $post, t("Send message"));
+    $this->drupalPostForm("contact", $post, $this->t("Send message"));
     $this->assertText($this->confirmation_message);
     $mails = $this->drupalGetMails();
     $mail = end($mails);
diff --git a/src/Tests/TestEmailTest.php b/src/Tests/TestEmailTest.php
index c4e3c11..d700264 100644
--- a/src/Tests/TestEmailTest.php
+++ b/src/Tests/TestEmailTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\reroute_email\Tests;
 
 use Drupal\reroute_email\RerouteEmailTestBase;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
 
 /**
  * Test Reroute Email's form for sending a test email.
@@ -25,7 +26,7 @@ class TestEmailTest extends RerouteEmailTestBase {
 
     // Check Subject field default value.
     $this->drupalGet("admin/config/development/reroute_email/test");
-    $this->assertFieldByName('subject', t("Reroute Email Test"), 'The expected default value was found for the Subject field.');
+    $this->assertFieldByName('subject', $this->t("Reroute Email Test"), 'The expected default value was found for the Subject field.');
 
     // Submit the Test Email form to send an email to be rerouted.
     $post = array(
@@ -35,8 +36,8 @@ class TestEmailTest extends RerouteEmailTestBase {
       'subject' => "Test Reroute Email Test Email Form",
       'body' => 'Testing email rerouting and the Test Email form',
     );
-    $this->drupalPostForm("admin/config/development/reroute_email/test", $post, t("Send email"));
-    $this->assertText(t("Test email submitted for delivery from test form."));
+    $this->drupalPostForm("admin/config/development/reroute_email/test", $post, $this->t("Send email"));
+    $this->assertText($this->t("Test email submitted for delivery from test form."));
     $mails = $this->drupalGetMails();
     $mail = end($mails);
     // Check rerouted email to.
@@ -53,8 +54,8 @@ class TestEmailTest extends RerouteEmailTestBase {
     $this->assertFalse(strpos($mail['body'], $post['body']) === FALSE, 'Body contains the value submitted through the form');
 
     // Check required To field.
-    $this->drupalPostForm("admin/config/development/reroute_email/test", array('to' => ''), t("Send email"));
-    $this->assertText(t("To field is required."));
+    $this->drupalPostForm("admin/config/development/reroute_email/test", array('to' => ''), $this->t("Send email"));
+    $this->assertText($this->t("To field is required."));
 
     // Test form submission with email rerouting and invalid email addresses.
     $post = array(
@@ -62,9 +63,9 @@ class TestEmailTest extends RerouteEmailTestBase {
       'cc' => "Cc address invalid format",
       'bcc' => "Bcc address invalid format",
     );
-    $this->drupalPostForm("admin/config/development/reroute_email/test", $post, t("Send email"));
+    $this->drupalPostForm("admin/config/development/reroute_email/test", $post, $this->t("Send email"));
     // Successful submission with email rerouting enabled.
-    $this->assertText(t("Test email submitted for delivery from test form."));
+    $this->assertText($this->t("Test email submitted for delivery from test form."));
     $mails = $this->drupalGetMails();
     $mail = end($mails);
     // Check rerouted email to.
@@ -82,13 +83,13 @@ class TestEmailTest extends RerouteEmailTestBase {
     $this->configureRerouteEmail(NULL, FALSE);
 
     // Submit the test email form again with previously used invalid addresses.
-    $this->drupalPostForm("admin/config/development/reroute_email/test", $post, t("Send email"));
+    $this->drupalPostForm("admin/config/development/reroute_email/test", $post, $this->t("Send email"));
     // Check invalid email addresses are still passed to the mail system.
     $mails = $this->drupalGetMails();
     $mail = end($mails);
     // Check rerouted email to.
     $this->assertMail('to', $post['to'], format_string('To email address is correctly set to submitted value: @address.', array('@address' => $post['to'])));
-    $this->verbose(t('Sent email values: <pre>@mail</pre>', array('@mail' => var_export($mail, TRUE))));
+    $this->verbose($this->t('Sent email values: <pre>@mail</pre>', array('@mail' => var_export($mail, TRUE))));
     // Check the Cc and Bcc headers are the ones submitted through the form.
     $this->assertTrue($mail['headers']['Cc'] == $post['cc'], format_string('Cc is correctly set to submitted value: @address', array('@address' => $post['cc'])));
     $this->assertTrue($mail['headers']['Bcc'] == $post['bcc'], format_string('Bcc is correctly set to submitted value: @address', array('@address' => $post['bcc'])));
diff --git a/src/Tests/UnusualMessageFieldsTest.php b/src/Tests/UnusualMessageFieldsTest.php
index 68732f9..df539e5 100644
--- a/src/Tests/UnusualMessageFieldsTest.php
+++ b/src/Tests/UnusualMessageFieldsTest.php
@@ -2,6 +2,7 @@
 namespace Drupal\reroute_email\Tests;
 
 use Drupal\reroute_email\RerouteEmailTestBase;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
 
 /**
  * Test handling of
@@ -58,7 +59,7 @@ class UnusualMessageFieldsTest extends RerouteEmailTestBase {
     \Drupal::getContainer()
       ->get('plugin.manager.mail')
       ->mail('reroute_email_test', 'test_reroute_email', $test_message['to'], $langcode, $test_message['params']);
-    $this->verbose(t('Test email message values: <pre>@test_message</pre>', array('@test_message' => var_export($test_message, TRUE))));
+    $this->verbose($this->t('Test email message values: <pre>@test_message</pre>', array('@test_message' => var_export($test_message, TRUE))));
 
     $mails = $this->drupalGetMails();
     $mail = end($mails);
@@ -73,7 +74,7 @@ class UnusualMessageFieldsTest extends RerouteEmailTestBase {
 
     // Check the watchdog entry logged by reroute_email_test_mail_alter.
     $this->drupalGet('admin/reports/dblog');
-    $this->assertRaw(t('A String was detected in the body'), 'Recorded in recent log messages: a String was detected in the body.');
+    $this->assertRaw($this->t('A String was detected in the body'), 'Recorded in recent log messages: a String was detected in the body.');
 
     // Test the robustness of the CC and BCC keys in headers.
     $this->assertTrue($mail['headers']['X-Rerouted-Original-Cc'] == $test_message['params']['headers'][$test_cc_key], format_string('X-Rerouted-Original-Cc is correctly set to @test_cc_address, although Cc header message key provided was: @test_cc_key', array(
