How to force entity translations to load in a certain language with user_view() or entity_view() I have a custom view mode that uses a template to print out user profiles.

I am saving the HTML from this view mode in the Solr search index using Search API Solr.

In user--my-view-mode.tpl.php, I print out the various fields of the user profile, including one that is a taxonomy term that has been translated by the Entity Reference and Title modules:

  $agegroup = $user_profile['field_acc_age_group'][1]['#markup'];


In the Search API callback, I call this view mode like this:

$render = user_view($item, 'my-view-mode', 'ja');


Here's the problem-- the profile is rendered in Japanese except the taxonomy term, which has been translated by Entity Reference/Title.

When I make a view that shows output of Rendered User and set the view mode to my-view-mode, and access the view with a user who has the language set to Japanese, then the taxonomy term is translated correctly.

So how do I get user_view() or entity_view() to show translated entity translations along with the rest of the translated output?
So one workaround is to force it manually like this:

$agegroup = $user_profile['field_acc_age_group']['#items'][1]['taxonomy_term']-&gt;name_field[$lang][0]['value'];