Use getTranslationFromContext instead of checking for translation in translate entity processors

Created on 30 March 2021, about 3 years ago
Updated 16 February 2023, over 1 year ago

Currently there is this code used in TranslateEntityProcessor and TranslateEntityAggregatedFieldProcessor

     // Check for a translation of the entity and load that instead if one's
      // found.
      if ($entity instanceof TranslatableInterface && $entity->hasTranslation($language_interface->getId())) {
        $entity = $entity->getTranslation($language_interface->getId());
      }

This check does not take into account the language fallbacks and generally there is \Drupal::service('entity.repository')->getTranslationFromContext intended for this

πŸ› Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium Radelson

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024