You are here

function webform_localization_emails_translation_string_refresh in Webform Localization 7.4

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

Update / create translation source for webform email properties.

Parameters

array $emails: An array of webform emails.

int $nid: The node Id of the webform.

1 call to webform_localization_emails_translation_string_refresh()
webform_localization_i18n_string_refresh in ./webform_localization.module
Update / create / delete translation source for components.

File

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

Code

function webform_localization_emails_translation_string_refresh($emails, $nid) {
  foreach ($emails as $email) {
    $eid = $email['eid'];
    if (!empty($email['subject']) && $email['subject'] != 'default') {
      $name = webform_localization_i18n_string_name($nid, 'email', $eid, 'subject_custom');
      i18n_string($name, $email['subject'], array(
        'update' => TRUE,
      ));
    }

    // 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');
      i18n_string($name, $email['email'], array(
        'update' => TRUE,
      ));
    }
    if (!empty($email['from_name']) && $email['from_name'] != 'default') {
      $name = webform_localization_i18n_string_name($nid, 'email', $eid, 'from_name_custom');
      i18n_string($name, $email['from_name'], array(
        'update' => TRUE,
      ));
    }
    if (!empty($email['template']) && $email['template'] != 'default') {
      $name = webform_localization_i18n_string_name($nid, 'email', $eid, 'template');
      i18n_string($name, $email['template'], array(
        'update' => TRUE,
      ));
    }
  }
}