How to load a node based on current language? I have 2 content bundles for node entity:


Custom Layout Pages (custom_layout)
Recipes (recipe)


Then I created two content using those content types, Potato (recipe) and Homepage (custom_layout).

I have 2 languages for both content, en and fr. I'm trying to load the potato recipe node inside of the homepage content.

So inside the preprocess hook, I have this code

...
if(isset($vars['node']) &amp;&amp; $vars['node']-&gt;type === 'custom_layout'){
    $recipe_id = 10;
    $vars['recipe_side'] = render(node_view(node_load($recipe_id)));
}
...


Then I echo the $recipe_side in the custom_layout template file.

When I load the fr version of the page, I expected the recipe to be loaded in fr as well, but it always displays the en version.

I'm guessing it's because the en recipe node id is 10, and it doesn't load the translated node.

If that's the case, how can I make it work so that the loaded node follows the current language?
Try this code:

 $node_trad = node_load($variables["node"]-&gt;nid); // in your case, 10.
 $idi_trad = translation_node_get_translations($node_trad-&gt;tnid);

  $vars['recipe_side'] = render(node_view(node_load($idi_trad["fr"]-&gt;nid)));
  //$vars['recipe_side'] = render(node_view(node_load($idi_trad[$language-&gt;language]-&gt;nid)));
  // alternative, more dynamical                


Essentialy you load the node in original language, use the translation function to get all available translations, and use that what you need.
Instead of "fr" you could use language-&gt;language instead to make it completely dynamical.