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) {
return $entity instanceof EntityNG ? $entity
->getTranslation($langcode) : $entity;
}