Commit fdf7fde1 authored by alexpott's avatar alexpott

Issue #2651986 by maxocub, balagan, Tom Robert, Kristen Pol, tstoeckler: Local...

Issue #2651986 by maxocub, balagan, Tom Robert, Kristen Pol, tstoeckler: Local task link "Translate" is not translated
parent 783fead6
...@@ -11,11 +11,14 @@ ...@@ -11,11 +11,14 @@
use Drupal\Component\Plugin\Derivative\DeriverBase; use Drupal\Component\Plugin\Derivative\DeriverBase;
use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface; use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\StringTranslation\TranslationInterface;
/** /**
* Provides dynamic local tasks for content translation. * Provides dynamic local tasks for content translation.
*/ */
class ContentTranslationLocalTasks extends DeriverBase implements ContainerDeriverInterface { class ContentTranslationLocalTasks extends DeriverBase implements ContainerDeriverInterface {
use StringTranslationTrait;
/** /**
* The base plugin ID * The base plugin ID
...@@ -38,10 +41,13 @@ class ContentTranslationLocalTasks extends DeriverBase implements ContainerDeriv ...@@ -38,10 +41,13 @@ class ContentTranslationLocalTasks extends DeriverBase implements ContainerDeriv
* The base plugin ID. * The base plugin ID.
* @param \Drupal\content_translation\ContentTranslationManagerInterface $content_translation_manager * @param \Drupal\content_translation\ContentTranslationManagerInterface $content_translation_manager
* The content translation manager. * The content translation manager.
* @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
* The translation manager.
*/ */
public function __construct($base_plugin_id, ContentTranslationManagerInterface $content_translation_manager) { public function __construct($base_plugin_id, ContentTranslationManagerInterface $content_translation_manager, TranslationInterface $string_translation) {
$this->basePluginId = $base_plugin_id; $this->basePluginId = $base_plugin_id;
$this->contentTranslationManager = $content_translation_manager; $this->contentTranslationManager = $content_translation_manager;
$this->stringTranslation = $string_translation;
} }
/** /**
...@@ -50,7 +56,8 @@ public function __construct($base_plugin_id, ContentTranslationManagerInterface ...@@ -50,7 +56,8 @@ public function __construct($base_plugin_id, ContentTranslationManagerInterface
public static function create(ContainerInterface $container, $base_plugin_id) { public static function create(ContainerInterface $container, $base_plugin_id) {
return new static( return new static(
$base_plugin_id, $base_plugin_id,
$container->get('content_translation.manager') $container->get('content_translation.manager'),
$container->get('string_translation')
); );
} }
...@@ -66,7 +73,7 @@ public function getDerivativeDefinitions($base_plugin_definition) { ...@@ -66,7 +73,7 @@ public function getDerivativeDefinitions($base_plugin_definition) {
$base_route_name = "entity.$entity_type_id.canonical"; $base_route_name = "entity.$entity_type_id.canonical";
$this->derivatives[$translation_route_name] = array( $this->derivatives[$translation_route_name] = array(
'entity_type' => $entity_type_id, 'entity_type' => $entity_type_id,
'title' => 'Translate', 'title' => $this->t('Translate'),
'route_name' => $translation_route_name, 'route_name' => $translation_route_name,
'base_route' => $base_route_name, 'base_route' => $base_route_name,
) + $base_plugin_definition; ) + $base_plugin_definition;
......
...@@ -37,6 +37,7 @@ protected function setUp() { ...@@ -37,6 +37,7 @@ protected function setUp() {
'node' => $entity_type, 'node' => $entity_type,
))); )));
\Drupal::getContainer()->set('content_translation.manager', $content_translation_manager); \Drupal::getContainer()->set('content_translation.manager', $content_translation_manager);
\Drupal::getContainer()->set('string_translation', $this->getStringTranslationStub());
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment