I’m using entity_metadata_wrapper with entity translation to print fields in a template, but it always prints the default language when using a langcode in the options.
$wrap = entity_metadata_wrapper('node', $node->nid, array('langcode' => 'zh-hans')); print $wrap->field_main_subtitle->value(); // Returns English value
Printing out the $wrap array shows the following towards the end which might give some clue (langcode:protected => und):
[propertyInfoAltered:protected] => [langcode:protected] => und [propertyInfoDefaults:protected] => Array ( [type] => text [getter callback] => entity_property_verbatim_get [clear] => Array ( ) ) [type:protected] => node [data:protected] => [info:protected] => Array ( [langcode] => zh-hans [type] => node [property defaults] => Array ( ) )
Any ideas?
Sponsored by SupremePR