summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2016-03-21 21:20:05 (GMT)
committerAlex Pott2016-03-21 21:20:05 (GMT)
commitfdf7fde1f565da8346dcc96a75a1fc25493ffe2f (patch)
tree2472c8ea63952da37b393643762caff63a879bc9
parent783fead6041b3be52512ea82d752151fe071b64c (diff)
Issue #2651986 by maxocub, balagan, Tom Robert, Kristen Pol, tstoeckler: Local task link "Translate" is not translated
-rw-r--r--core/modules/content_translation/src/Plugin/Derivative/ContentTranslationLocalTasks.php13
-rw-r--r--core/modules/content_translation/tests/src/Unit/Menu/ContentTranslationLocalTasksTest.php1
2 files changed, 11 insertions, 3 deletions
diff --git a/core/modules/content_translation/src/Plugin/Derivative/ContentTranslationLocalTasks.php b/core/modules/content_translation/src/Plugin/Derivative/ContentTranslationLocalTasks.php
index 995de59..00cdfe2 100644
--- a/core/modules/content_translation/src/Plugin/Derivative/ContentTranslationLocalTasks.php
+++ b/core/modules/content_translation/src/Plugin/Derivative/ContentTranslationLocalTasks.php
@@ -11,11 +11,14 @@ use Drupal\content_translation\ContentTranslationManagerInterface;
use Drupal\Component\Plugin\Derivative\DeriverBase;
use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
+use Drupal\Core\StringTranslation\StringTranslationTrait;
+use Drupal\Core\StringTranslation\TranslationInterface;
/**
* Provides dynamic local tasks for content translation.
*/
class ContentTranslationLocalTasks extends DeriverBase implements ContainerDeriverInterface {
+ use StringTranslationTrait;
/**
* The base plugin ID
@@ -38,10 +41,13 @@ class ContentTranslationLocalTasks extends DeriverBase implements ContainerDeriv
* The base plugin ID.
* @param \Drupal\content_translation\ContentTranslationManagerInterface $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->contentTranslationManager = $content_translation_manager;
+ $this->stringTranslation = $string_translation;
}
/**
@@ -50,7 +56,8 @@ class ContentTranslationLocalTasks extends DeriverBase implements ContainerDeriv
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static(
$base_plugin_id,
- $container->get('content_translation.manager')
+ $container->get('content_translation.manager'),
+ $container->get('string_translation')
);
}
@@ -66,7 +73,7 @@ class ContentTranslationLocalTasks extends DeriverBase implements ContainerDeriv
$base_route_name = "entity.$entity_type_id.canonical";
$this->derivatives[$translation_route_name] = array(
'entity_type' => $entity_type_id,
- 'title' => 'Translate',
+ 'title' => $this->t('Translate'),
'route_name' => $translation_route_name,
'base_route' => $base_route_name,
) + $base_plugin_definition;
diff --git a/core/modules/content_translation/tests/src/Unit/Menu/ContentTranslationLocalTasksTest.php b/core/modules/content_translation/tests/src/Unit/Menu/ContentTranslationLocalTasksTest.php
index f11f783..0b7fe85 100644
--- a/core/modules/content_translation/tests/src/Unit/Menu/ContentTranslationLocalTasksTest.php
+++ b/core/modules/content_translation/tests/src/Unit/Menu/ContentTranslationLocalTasksTest.php
@@ -37,6 +37,7 @@ class ContentTranslationLocalTasksTest extends LocalTaskIntegrationTestBase {
'node' => $entity_type,
)));
\Drupal::getContainer()->set('content_translation.manager', $content_translation_manager);
+ \Drupal::getContainer()->set('string_translation', $this->getStringTranslationStub());
}
/**