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

In Drupal 7 and before, the 'language' property on nodes ($node->language) signified the language the node is saved with. As part of a bigger unification effort to differentiate language codes from language objects in the API, this was renamed to 'langcode' ($node->langcode). Now if you see 'language', that should be a language object and not a language code.

Along with that change, two minor things were also changed for consistency:

  1. The 'language' form element in the node edit form was renamed to 'langcode'.
  2. The 'language' variable that is used for theming nodes ('#theme' => 'node') was renamed to 'langcode'. See the examples below for more information.

Drupal 7:

<?php
// Returns the language code of a node.
$node = node_load(1);
return
$node->language;
// Unsets the language element on the node form.
function example_form_node_form_alter(&$form, &$form_state) {
  unset(
$form['language']);
}
// Returns the language code of a node as a renderable array.
$render_array = node_view($node);
return
$render_array['#language'];
// Preprocesses nodes for theming. Sets a custom language code.
function example_preprocess_node(&$variables) {
 
$variables['language'] = 'en-gb';
}
?>

Drupal 8:

<?php
// Returns the language code of a node.
$node = node_load(1);
return
$node->langcode;
// Unsets the language element on the node form.
function example_form_node_form_alter(&$form, &$form_state) {
  unset(
$form['langcode']);
}
// Returns the language code of a node as a renderable array.
$render_array = node_view($node);
return
$render_array['#langcode'];
// Preprocesses nodes for theming. Sets a custom language code.
function example_preprocess_node(&$variables) {
 
$variables['langcode'] = 'en-gb';
}
?>
Impacts: 
Module developers
Themers
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