You are here

function webform_localization_email_translate_strings in Webform Localization 7

Same name and namespace in other branches
  1. 7.4 includes/webform_localization.i18n.inc \webform_localization_email_translate_strings()

Translate webform email poperties.

Parameters

$node: A node object.

1 call to webform_localization_email_translate_strings()
webform_localization_node_load in ./webform_localization.module
Implements hook_node_load().

File

includes/webform_localization.i18n.inc, line 374
Webform Localization i18n_string integration.

Code

function webform_localization_email_translate_strings(&$node) {
  $nid = $node->webform['nid'];
  foreach ($node->webform['emails'] as $eid => &$email) {
    if (!empty($email['subject']) && $email['subject'] != 'default') {
      $name = webform_localization_i18n_string_name($nid, 'email', $eid, 'subject_custom');
      $email['subject'] = i18n_string($name, $email['subject']);
    }

    // Allow to translate the mail recipients if not based on a component.
    if (!empty($email['email']) && !is_numeric($email['email'])) {
      $name = webform_localization_i18n_string_name($nid, 'email', $eid, 'email');
      $email['email'] = i18n_string($name, $email['email']);
    }
    if (!empty($email['from_name']) && $email['from_name'] != 'default') {
      $name = webform_localization_i18n_string_name($nid, 'email', $eid, 'from_name_custom');
      $email['from_name'] = i18n_string($name, $email['from_name']);
    }
    if (!empty($email['template']) && $email['template'] != 'default') {
      $name = webform_localization_i18n_string_name($nid, 'email', $eid, 'template');
      $email['template'] = i18n_string($name, $email['template']);
    }
  }
}