diff --git a/core/modules/comment/comment.services.yml b/core/modules/comment/comment.services.yml index 3599592..074d812 100644 --- a/core/modules/comment/comment.services.yml +++ b/core/modules/comment/comment.services.yml @@ -3,3 +3,4 @@ services: class: Drupal\comment\CommentBreadcrumbBuilder tags: - { name: breadcrumb_builder, priority: 100 } + arguments: ['@string_translation'] diff --git a/core/modules/comment/lib/Drupal/comment/CommentBreadcrumbBuilder.php b/core/modules/comment/lib/Drupal/comment/CommentBreadcrumbBuilder.php index fcaf24a..01b3d48 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentBreadcrumbBuilder.php +++ b/core/modules/comment/lib/Drupal/comment/CommentBreadcrumbBuilder.php @@ -8,6 +8,7 @@ namespace Drupal\comment; use Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface; +use Drupal\Core\StringTranslation\TranslationManager; /** * Class to define the comment breadcrumb builder. @@ -15,13 +16,30 @@ class CommentBreadcrumbBuilder implements BreadcrumbBuilderInterface { /** + * The translation manager service. + * + * @var \Drupal\Core\StringTranslation\TranslationManager + */ + protected $translation; + + /** + * Constructs a CommentBreadcrumbBuilder object. + * + * @param \Drupal\Core\StringTranslation\TranslationManager $translation + * The translation manager. + */ + public function __construct(TranslationManager $translation) { + $this->translation = $translation; + } + + /** * {@inheritdoc} */ public function build(array $attributes) { if (isset($attributes['_route']) && $attributes['_route'] == 'comment_reply') { $node = $attributes['node']; $uri = $node->uri(); - $breadcrumb[] = l(t('Home'), NULL); + $breadcrumb[] = l($this->translation->translate('Home'), NULL); $breadcrumb[] = l($node->label(), $uri['path']); return $breadcrumb; }