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

We had an inconsistency between the storage of the entity language and the language of configurable field original values. If a field was not translatable, storage of the field values always used the 'und' language code, no matter which language the entity had. The reason for it was not having to mess with field language codes when changing entity language. However this introduced an inconsistency that was problematic: base fields were stored under the original language, as they all share the same record in the data table, and this introduced additional complexity when joining field tables or needing to filter by field language. Additionally configurable field storage was inconsistent between entity data structures and the underlying storage.

We resolved these issues aiming for the following design principles:

  • Base fields and configurable fields should be handled the same way.
  • Language codes in the storage should match those in runtime entities / field items.

We now only use und if the original entity is und. If the original entity is not und then original field values (both base and configurable) inherit from the entity language code: a de entity would get de values even for untranslatable fields. The entity data structure is now able to treat untranslatable fields as shared no matter which language code they have.

This cleanly addresses the following use-cases:

  • Change base/original entity language (special case: und => xx language)
  • Switching translatability for fields without requiring a data migration
  • Querying on configurable fields
  • Disabling translatability of entity types without data migration needed

The public API did not change. Even before this patch, the entity system internally handled the lookup of proper values. So even before and after this change, this code would work the same:

$translation = $entity->getTranslation('de');
$value = $translation->field_foo->value;

The site admin facing benefit of this change is further explained in https://drupal.org/node/2147921.

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
Details: 
Progress: