Getting translations programmatically from non-default language Scenario: I have the original string: "Perro", which has its translations: EN => "Dog", FR => "Chien".
Mission: In my custom module, I have the string "Chien" and I need to get its English translation, "Dog".
This will work for a node that has a field_animal with translation (in Drupal 8).
First we found the french translation then we compare with the string, second we fetch the english translation.

$myString = 'Chien';
$translation = \Drupal::service('entity.repository')-&gt;getTranslationFromContext($node, 'fr');
$animalFr = $translation-&gt;get('field_animal')-&gt;value;
if ($myString == $animalFr){
  $translation = \Drupal::service('entity.repository')-&gt;getTranslationFromContext($node, 'en');
  $animalEn = $translation-&gt;get('field_animal')-&gt;value;
}