Fetching node translation
$node = Node::load($nid);
$node->getTitle(); // returns title in en(default language).
$translated_node = \Drupal::service('entity.repository')->getTranslationFromContext($node, 'es');
$translated_node->getTitle(); // Returns translated title in es (spanish).
If we want to fetch the bundle's translation. The above approach doesn't work.
Kindly advise?
$article = $node->bundle();
$article->label(); // returns "Article".
$translated = \Drupal::service('entity.repository')->getTranslationFromContext($article, 'es');
$translated->label(); // Also returns "Article".
Translation for bundles provided from /admin/structure/types/manage/article/translate/es/edit