diff -u b/core/lib/Drupal/Core/Form/FormBase.php b/core/lib/Drupal/Core/Form/FormBase.php --- b/core/lib/Drupal/Core/Form/FormBase.php +++ b/core/lib/Drupal/Core/Form/FormBase.php @@ -24,22 +24,10 @@ protected $translationManager; /** - * Constructs the FormBase object. - * - * @param \Drupal\Core\StringTranslation\Translator\TranslatorInterface $translation_manager - * The translation manager. - */ - public function __construct(TranslatorInterface $translation_manager) { - $this->translationManager = $translation_manager; - } - - /** * {@inheritdoc} */ public static function create(ContainerInterface $container) { - return new static( - $container->get('string_translation') - ); + return new static; } /** @@ -69,7 +57,18 @@ * The translated string. */ protected function t($string, array $args = array(), array $options = array()) { - return $this->translationManager->translate($string, $args, $options); + return $this->translator()->translate($string, $args, $options); + } + + protected function translator() { + if (!$this->translationManager) { + $this->translationManager = \Drupal::translation(); + } + return $this->translationManager; + } + + public function setTranslator($translation_manager) { + $this->translationManager = $translationManager; } } diff -u b/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php b/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php --- b/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php +++ b/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php @@ -12,7 +12,6 @@ use Drupal\Core\Form\FormBase; use Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface; use Drupal\Core\Routing\PathBasedGeneratorInterface; -use Drupal\Core\StringTranslation\TranslationManager; use Drupal\Component\Utility\Unicode; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; @@ -54,8 +53,7 @@ public static function create(ContainerInterface $container) { return new static( $container->get('module_handler'), - $container->get('keyvalue.expirable')->get('module_list'), - $container->get('string_translation') + $container->get('keyvalue.expirable')->get('module_list') ); } @@ -66,12 +64,8 @@ * The module handler. * @param \Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface $key_value_expirable * The key value expirable factory. - * @param \Drupal\Core\StringTranslation\TranslationManager - * The translation manager. */ - public function __construct(ModuleHandlerInterface $module_handler, KeyValueStoreExpirableInterface $key_value_expirable, TranslationManager $translation_manager) { - parent::__construct($translation_manager); - + public function __construct(ModuleHandlerInterface $module_handler, KeyValueStoreExpirableInterface $key_value_expirable) { $this->moduleHandler = $module_handler; $this->keyValueExpirable = $key_value_expirable; } diff -u b/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php b/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php --- b/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php +++ b/core/modules/system/lib/Drupal/system/Form/ModulesUninstallForm.php @@ -47,8 +47,7 @@ public static function create(ContainerInterface $container) { return new static( $container->get('module_handler'), - $container->get('keyvalue.expirable')->get('modules_uninstall'), - $container->get('string_translation') + $container->get('keyvalue.expirable')->get('modules_uninstall') ); } @@ -59,12 +58,8 @@ * The module handler. * @param \Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface $key_value_expirable * The key value expirable factory. - * @param \Drupal\Core\StringTranslation\TranslationManager $translation_manager - * The translation manager. */ - public function __construct(ModuleHandlerInterface $module_handler, KeyValueStoreExpirableInterface $key_value_expirable, TranslationManager $translation_manager) { - parent::__construct($translation_manager); - + public function __construct(ModuleHandlerInterface $module_handler, KeyValueStoreExpirableInterface $key_value_expirable) { $this->moduleHandler = $module_handler; $this->keyValueExpirable = $key_value_expirable; } diff -u b/core/modules/system/lib/Drupal/system/SystemConfigFormBase.php b/core/modules/system/lib/Drupal/system/SystemConfigFormBase.php --- b/core/modules/system/lib/Drupal/system/SystemConfigFormBase.php +++ b/core/modules/system/lib/Drupal/system/SystemConfigFormBase.php @@ -11,7 +11,6 @@ use Drupal\Core\Controller\ControllerInterface; use Drupal\Core\Config\ConfigFactory; use Drupal\Core\Config\Context\ContextInterface; -use Drupal\Core\StringTranslation\Translator\TranslatorInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -33,12 +32,8 @@ * The factory for configuration objects. * @param \Drupal\Core\Config\Context\ContextInterface $context * The configuration context to use. - * @param \Drupal\Core\StringTranslation\Translator\TranslatorInterface $translation_manager - * The translation manager. */ - public function __construct(ConfigFactory $config_factory, ContextInterface $context, TranslatorInterface $translation_manager) { - parent::__construct($translation_manager); - + public function __construct(ConfigFactory $config_factory, ContextInterface $context) { $this->configFactory = $config_factory; $this->configFactory->enterContext($context); } @@ -49,8 +44,7 @@ public static function create(ContainerInterface $container) { return new static( $container->get('config.factory'), - $container->get('config.context.free'), - $container->get('string_translation') + $container->get('config.context.free') ); }