Just wondering how to make the webform components labels translatable. I found this post with a link to a sandbox project but I don't where to download the module: Make Webform multilingual (i18n) aware through contributed modules
I also find this function to just make what I need but it doesn't work, maybe with a few change it will work: Source: work around
function module_name_form_webform_client_form_xx_alter(&$form, &$form_state) {
foreach (element_children($form['submitted']) as $element) {
// Pass each webform component title through the t() function.
$form['submitted'][$element]['#title'] = t($form['submitted'][$element]['#title']);
}
}
The function provided by @lenni does the job but I get these error messages.
Warning: strlen() expects parameter 1 to be string, array given en drupal_validate_utf8() (línea 1600 de/Applications/MAMP/htdocs/tonisacristan.com/includes/bootstrap.inc).
Notice: Array to string conversion en filter_xss() (línea 1366 de /Applications/MAMP/htdocs/tonisacristan.com/includes/common.inc).
Notice: Array to string conversion en format_string() (línea 1552 de /Applications/MAMP/htdocs/tonisacristan.com/includes/bootstrap.inc).
The source of the problem is a Markup component. This function is working fine.
function webform_extras_node_view($node, $view_mode, $langcode) {
if($node->type == 'webform' && $view_mode == 'full') {
// translate the webform component labels
foreach(element_children($node->content['webform']['#form']['submitted']) as $key){
//to skip Markup components
if($key != 'my_markup_component'){
$node->content['webform']['#form']['submitted'][$key]['#title'] = t($node->content['webform']['#form']['submitted'][$key]['#title']);
}
}
}
}