- Issue created by @anrikun
- 🇨🇦Canada joseph.olstad
Probably do not have to do that, have you tried this?
- Status changed to Needs review
over 1 year ago 4:38pm 22 March 2024
This is the continuation of #2296833: Translate field properties used in entity_get_property_info() →
When running for instance code below just after a cache flush, the property's label is left untranslated.
<?php
$wrapper = entity_metadata_wrapper('node', NULL, array('bundle' => 'page));
$property_info = $wrapper->getPropertyInfo('field_example');
echo $property_info['label'];
?>
The only stable workaround I've found so far is to run this code before displaying the label of a field:
<?php
$wrapper = entity_metadata_wrapper('node', NULL, array('bundle' => 'my_node_type'));
$property_info = $wrapper->getPropertyInfo('my_field_name');
if ($instance = field_info_instance('node', 'my_field_name', 'my_node_type')) {
$property_info['label'] = i18n_field_translate_property($instance, 'label');
}
?>
Needs review
1.0
Documentation
Probably do not have to do that, have you tried this?