diff --git a/core/lib/Drupal/Core/Entity/Annotation/EntityType.php b/core/lib/Drupal/Core/Entity/Annotation/EntityType.php index b5a0401..ffa31a0 100644 --- a/core/lib/Drupal/Core/Entity/Annotation/EntityType.php +++ b/core/lib/Drupal/Core/Entity/Annotation/EntityType.php @@ -60,13 +60,4 @@ public function get() { return new $class($values); } - /** - * Translates a string to the current language or to a given language. - * - * See the t() documentation for details. - */ - protected function t($string, array $args = array(), array $options = array()) { - return \Drupal::translation()->translate($string, $args, $options); - } - } diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php index 2b93b36..bc3e563 100644 --- a/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -22,6 +22,7 @@ use Drupal\Core\Plugin\Discovery\CacheDecorator; use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery; use Drupal\Core\Plugin\Discovery\InfoHookDecorator; +use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\StringTranslation\TranslationInterface; use Drupal\Core\TypedData\TranslatableInterface; use Symfony\Component\DependencyInjection\ContainerAwareInterface; @@ -44,6 +45,7 @@ class EntityManager extends PluginManagerBase implements EntityManagerInterface, ContainerAwareInterface { use ContainerAwareTrait; + use StringTranslationTrait; /** * Extra fields by bundle. @@ -817,13 +819,4 @@ protected function getDisplayModeOptions($display_type, $entity_type_id, $includ return $options; } - /** - * Translates a string to the current language or to a given language. - * - * See the t() documentation for details. - */ - protected function t($string, array $args = array(), array $options = array()) { - return $this->translationManager->translate($string, $args, $options); - } - } diff --git a/core/lib/Drupal/Core/Entity/EntityType.php b/core/lib/Drupal/Core/Entity/EntityType.php index 7ad2a7c..5be662f 100644 --- a/core/lib/Drupal/Core/Entity/EntityType.php +++ b/core/lib/Drupal/Core/Entity/EntityType.php @@ -10,12 +10,15 @@ use Drupal\Component\Utility\String; use Drupal\Component\Utility\Unicode; use Drupal\Core\Entity\Exception\EntityTypeIdLengthException; +use Drupal\Core\StringTranslation\StringTranslationTrait; /** * Provides an implementation of an entity type and its metadata. */ class EntityType implements EntityTypeInterface { + use StringTranslationTrait; + /** * Indicates whether entities should be statically cached. * @@ -627,13 +630,4 @@ public function getGroupLabel() { return !empty($this->group_label) ? $this->group_label : $this->t('Other', array(), array('context' => 'Entity type group')); } - /** - * Translates a string to the current language or to a given language. - * - * See the t() documentation for details. - */ - protected function t($string, array $args = array(), array $options = array()) { - return \Drupal::translation()->translate($string, $args, $options); - } - }