diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index aa0fbcb..fe138df 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -1539,7 +1539,7 @@ function t($string, array $args = array(), array $options = array()) {
   // handful of string replacements. See settings.php for examples.
   // Cache the $custom_strings variable to improve performance.
   if (!isset($custom_strings[$options['langcode']])) {
-    $custom_strings[$options['langcode']] = variable_get('locale_custom_strings_' . $options['langcode'], array());
+    $custom_strings[$options['langcode']] = settings()->get('locale_custom_strings_' . $options['langcode'], array());
   }
   // Custom strings work for English too, even if locale module is disabled.
   if (isset($custom_strings[$options['langcode']][$options['context']][$string])) {
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/FormatDateTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/FormatDateTest.php
index 1f2575c..d775de5 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/FormatDateTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/FormatDateTest.php
@@ -44,13 +44,12 @@ function setUp() {
       ->set('formats.medium.pattern.php', 'j. F Y - G:i')
       ->set('formats.short.pattern.php', 'Y M j - g:ia')
       ->save();
+    $this->refreshVariables();
 
-    variable_set('locale_custom_strings_' . self::LANGCODE, array(
+    $this->settingsSet('locale_custom_strings_' . self::LANGCODE, array(
       '' => array('Sunday' => 'domingo'),
       'Long month name' => array('March' => 'marzo'),
     ));
-
-    $this->refreshVariables();
   }
 
   /**
diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php
index 3b666a0..8237471 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php
@@ -7,13 +7,12 @@
 
 namespace Drupal\system\Tests\Menu;
 
-use PDO;
-use Drupal\simpletest\WebTestBase;
+use Drupal\system\Tests\System\CustomStringsTestBase;
 
 /**
  * Tests menu router and hook_menu() functionality.
  */
-class MenuRouterTest extends WebTestBase {
+class MenuRouterTest extends CustomStringsTestBase {
 
   /**
    * Modules to enable.
@@ -539,9 +538,12 @@ function testMenuItemTitlesCases() {
 
     foreach ($test_data as $case_no => $override) {
       $this->menuItemTitlesCasesHelper($case_no);
-      variable_set('locale_custom_strings_en', array('' => $override));
+      $this->addCustomTranslations('en', array('' => $override));
+      $this->writeCustomTranslations();
+
       $this->menuItemTitlesCasesHelper($case_no, TRUE);
-      variable_set('locale_custom_strings_en', array());
+      $this->addCustomTranslations('en', array());
+      $this->writeCustomTranslations();
     }
   }
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/Plugin/CacheDecoratorLanguageTest.php b/core/modules/system/lib/Drupal/system/Tests/Plugin/CacheDecoratorLanguageTest.php
index 23d01fa..57cf70b 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Plugin/CacheDecoratorLanguageTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Plugin/CacheDecoratorLanguageTest.php
@@ -9,12 +9,12 @@
 
 use Drupal\Core\Language\Language;
 use Drupal\plugin_test\Plugin\CachedMockBlockManager;
-use Drupal\simpletest\WebTestBase;
+use Drupal\system\Tests\System\CustomStringsTestBase;
 
 /**
  * Tests that the AlterDecorator fires and respects the alter hook.
  */
-class CacheDecoratorLanguageTest extends WebTestBase {
+class CacheDecoratorLanguageTest extends CustomStringsTestBase {
 
   /**
    * Modules to enable.
@@ -68,8 +68,10 @@ public function setUp() {
       foreach ($this->mockBlockExpectedDefinitions as $plugin_id => $definition) {
         $custom_strings[$definition['label']] = $langcode . ' ' . $definition['label'];
       }
-      variable_set('locale_custom_strings_' . $langcode, array('' => $custom_strings));
+      $this->addCustomTranslations($langcode, array('' => $custom_strings));
     }
+    // Write test settings.php with new translations.
+    $this->writeCustomTranslations();
   }
 
   /**
@@ -111,7 +113,8 @@ public function testCacheDecoratorLanguage() {
     foreach ($this->mockBlockExpectedDefinitions as $plugin_id => $definition) {
       $custom_strings[$definition['label']] = $definition['label'] . ' de';
     }
-    variable_set('locale_custom_strings_de', array('' => $custom_strings));
+    $this->addCustomTranslations('de', array('' => $custom_strings));
+    $this->writeCustomTranslations();
     $this->drupalGet('de/plugin_definition_test');
     foreach ($this->mockBlockExpectedDefinitions as $plugin_id => $definition) {
       // Find our provided translations.
diff --git a/core/modules/system/lib/Drupal/system/Tests/System/CustomStringsTestBase.php b/core/modules/system/lib/Drupal/system/Tests/System/CustomStringsTestBase.php
new file mode 100644
index 0000000..1a56c9e
--- /dev/null
+++ b/core/modules/system/lib/Drupal/system/Tests/System/CustomStringsTestBase.php
@@ -0,0 +1,59 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\system\Tests\System\CustomStringsTestBase.
+ */
+
+namespace Drupal\system\Tests\System;
+
+use Drupal\simpletest\WebTestBase;
+
+/**
+ * Defines a base class for testing custom string translations functionality.
+ */
+abstract class CustomStringsTestBase extends WebTestBase {
+
+  /**
+   * An array of custom translations suitable for drupal_rewrite_settings().
+   *
+   * @var array
+   */
+  protected $customTranslations;
+
+  /**
+   * Adds custom translations.
+   *
+   * @param string $langcode
+   *   The langcode to add translations for.
+   * @param array $values
+   *   Array of values containing the untranslated string and its translation.
+   *   For example:
+   *   @code
+   *   array(
+   *     '' => array('Sunday' => 'domingo'),
+   *     'Long month name' => array('March' => 'marzo'),
+   *   );
+   *   @endcode
+   */
+  protected function addCustomTranslations($langcode, array $values) {
+    $this->settingsSet('locale_custom_strings_' . $langcode, $values);
+    foreach ($values as $key => $translations) {
+      foreach ($translations as $label => $value) {
+        $this->customTranslations['locale_custom_strings_' . $langcode][$key][$label] = (object) array(
+          'value' => $value,
+          'required' => TRUE,
+        );
+      }
+    }
+  }
+
+  /**
+   * Writes custom translations to test site's settings.php.
+   */
+  protected function writeCustomTranslations() {
+    $this->writeSettings(array('settings' => $this->customTranslations));
+    $this->customTranslations = array();
+  }
+
+}
