Returns the translation object to use to retrieve the translated values.
\Drupal\Core\Entity\EntityInterface $entity: The entity being tested.
string $langcode: The language code identifying the translation to be retrieved.
\Drupal\Core\TypedData\TranslatableInterface The translation object to act on.
protected function getTranslation(EntityInterface $entity, $langcode) {
// @todo remove once EntityBCDecorator is gone.
$entity = $entity
->getNGEntity();
return $entity instanceof EntityNG ? $entity
->getTranslation($langcode, FALSE) : $entity;
}