Change record status: 
Project: 
Introduced in branch: 
8.0.x
Introduced in version: 
8.0.0-beta14
Description: 

Following on from introducing TranslatableMarkup usage in other menu link classes in #2338081: Local Tasks, Actions, and Contextual links mark strings from derivatives (or alter hooks) as safe and translated, MenuLinkDefault is now updated to use TranslatableMarkup for title and description in plugin definitions. The serialized title and description values in menu link storage (such as the database) may be a serialized TranslatableMarkup now.

Also in line with changes in #2338081: Local Tasks, Actions, and Contextual links mark strings from derivatives (or alter hooks) as safe and translated, support for title arguments in the plugin definition was removed. Implement getTitle() in a derivative class to regain that feature. See https://www.drupal.org/node/2540342 for a similar example.

A small API change is that implementations of hook_menu_links_discovered_alter() may need to create a TranslatableMarkup object instead of setting a simple string for the title and/or description.

Before: Drupal 8.0.0-beta12


function editor_menu_links_discovered_alter(array &$links) {
  $links['filter.admin_overview']['title'] = 'Text formats and editors';
  $links['filter.admin_overview']['description'] = 'Configure how user-contributed content is filtered and formatted, as well as the text editor user interface (WYSIWYGs or toolbars).';
}

After: Drupal 8.0.0-beta14


use Drupal\Core\StringTranslation\TranslatableMarkup;
...

function editor_menu_links_discovered_alter(array &$links) {
  $links['filter.admin_overview']['title'] = new TranslatableMarkup('Text formats and editors');
  $links['filter.admin_overview']['description'] = new TranslatableMarkup('Configure how user-contributed content is filtered and formatted, as well as the text editor user interface (WYSIWYGs or toolbars).');
}

Impacts: 
Module developers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done