diff --git a/core/lib/Drupal/Core/Cache/Context/IpCacheContext.php b/core/lib/Drupal/Core/Cache/Context/IpCacheContext.php
index aac2926..88d9824 100644
--- a/core/lib/Drupal/Core/Cache/Context/IpCacheContext.php
+++ b/core/lib/Drupal/Core/Cache/Context/IpCacheContext.php
@@ -8,6 +8,7 @@
 namespace Drupal\Core\Cache\Context;
 
 use Drupal\Core\Cache\CacheableMetadata;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
 
 /**
  * Defines the IpCacheContext service, for "per IP address" caching.
@@ -16,11 +17,13 @@
  */
 class IpCacheContext extends RequestStackCacheContextBase implements CacheContextInterface {
 
+  use StringTranslationTrait;
+
   /**
    * {@inheritdoc}
    */
   public static function getLabel() {
-    return t('IP address');
+    return static::staticT('IP address');
   }
 
   /**
diff --git a/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php b/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php
index 1d7592b..8a29324 100644
--- a/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php
+++ b/core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php
@@ -43,6 +43,15 @@ protected function t($string, array $args = array(), array $options = array()) {
   }
 
   /**
+   * Translates a string to the current language or to a given language.
+   *
+   * See the t() documentation for details.
+   */
+  protected static function staticT($string, array $args = array(), array $options = array()) {
+    return static::getStaticStringTranslation()->translate($string, $args, $options);
+  }
+
+  /**
    * Formats a string containing a count of items.
    *
    * See the \Drupal\Core\StringTranslation\TranslationInterface::formatPlural()
@@ -89,6 +98,16 @@ protected function getStringTranslation() {
   }
 
   /**
+   * Gets the string translation service.
+   *
+   * @return \Drupal\Core\StringTranslation\TranslationInterface
+   *   The string translation service.
+   */
+  protected static function getStaticStringTranslation() {
+    return \Drupal::service('string_translation');
+  }
+
+  /**
    * Sets the string translation service to use.
    *
    * @param \Drupal\Core\StringTranslation\TranslationInterface $translation
