Change record status: 
Project: 
Introduced in branch: 
8.x
Introduced in version: 
8.0
Description: 

When accessing a term's name, do not use the property itself, but rather the Entity::label() method. This will allow for improvements to the translatability of a term's title.

Drupal 7:

function taxonomy_term_page(Term $term) {
  // Assign the term name as the page title.
  drupal_set_title($term->name);
 
  // ...
  $breadcrumb = array();
  while ($parents = taxonomy_term_load_parents($current->tid)) {
    $current = array_shift($parents);
    $breadcrumb[] = l($current->name, 'taxonomy/term/' . $current->tid);
  }
  $breadcrumb[] = l(t('Home'), NULL);
  $breadcrumb = array_reverse($breadcrumb);
  drupal_set_breadcrumb($breadcrumb);

  drupal_add_feed('taxonomy/term/' . $term->tid . '/feed', 'RSS - ' . $term->name);

Drupal 8:

function taxonomy_term_page(Term $term) {
  // Assign the term name as the page title.
  drupal_set_title($term->label());
 
  // ...
  $breadcrumb = array();
  while ($parents = taxonomy_term_load_parents($current->tid)) {
    $current = array_shift($parents);
    $breadcrumb[] = l($current->label(), 'taxonomy/term/' . $current->tid);
  }
  $breadcrumb[] = l(t('Home'), NULL);
  $breadcrumb = array_reverse($breadcrumb);
  drupal_set_breadcrumb($breadcrumb);

  drupal_add_feed('taxonomy/term/' . $term->tid . '/feed', 'RSS - ' . $term->label());

However, setting the term name directly will still use $term->name = $new_name;. $term->name must also be used on entity edit forms, like '#default_value' => $term->name,.

Also note that in taxonomy_get_tree() there is the possibility to not load the whole term objects (see http://api.drupal.org/api/drupal/core%21modules%21taxonomy%21taxonomy.mo... with the $load_entities argument defaulting to FALSE). When you do need to use the term label(), you should read the whole entity. This also allows the potentially set title callback to be invoked.

Impacts: 
Module developers