### Eclipse Workspace Patch 1.0 #P webform-DRUPAL-6--3 Index: includes/webform.components.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/webform/includes/webform.components.inc,v retrieving revision 1.25.2.15 diff -u -r1.25.2.15 webform.components.inc --- includes/webform.components.inc 30 Jun 2010 20:45:25 -0000 1.25.2.15 +++ includes/webform.components.inc 5 Jul 2010 19:54:01 -0000 @@ -685,6 +685,14 @@ db_query('DELETE FROM {webform_component} WHERE nid = %d AND cid = %d', $node->nid, $component['cid']); db_query('DELETE FROM {webform_submitted_data} WHERE nid = %d AND cid = %d', $node->nid, $component['cid']); + if (module_exists('i18nstrings')) { + $nid = db_result(db_query("SELECT nid FROM {webform_component} WHERE name='%s'", $component['name'])); + if ($nid > 0) { //delete string if it's not being used somewhere else + $i18_identifier = "webform:webform:" . $component['name']; + i18nstrings_remove($i18_identifier); + } + } + // Delete all elements under this element. $result = db_query('SELECT cid FROM {webform_component} WHERE nid = %d AND pid = %d', $node->nid, $component['cid']); while ($row = db_fetch_object($result)) { Index: components/select.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/webform/components/select.inc,v retrieving revision 1.39.2.13 diff -u -r1.39.2.13 select.inc --- components/select.inc 10 Apr 2010 22:02:09 -0000 1.39.2.13 +++ components/select.inc 5 Jul 2010 19:54:01 -0000 @@ -794,6 +794,13 @@ elseif (preg_match('/^([^|]+)\|(.*)$/', $option, $matches)) { $key = $filter ? _webform_filter_values($matches[1], NULL, NULL, NULL, FALSE) : $matches[1]; $value = $filter ? _webform_filter_values($matches[2], NULL, NULL, NULL, FALSE) : $matches[2]; + + if (module_exists('i18nstrings')) { + $i18_identifier = "webform:webform:" . $value; + i18nstrings_update($i18_identifier, $value); + $value = i18nstrings($i18_identifier, $value); + } + isset($group) ? $options[$group][$key] = $value : $options[$key] = $value; } else { Index: webform.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/webform/webform.module,v retrieving revision 1.196.2.40 diff -u -r1.196.2.40 webform.module --- webform.module 30 Jun 2010 20:31:31 -0000 1.196.2.40 +++ webform.module 5 Jul 2010 19:54:00 -0000 @@ -1063,7 +1063,11 @@ $component['nid'] = $node->nid; $component['cid'] = $c['cid']; $component['form_key'] = $c['form_key'] ? $c['form_key'] : $c['cid']; - $component['name'] = t($c['name']); + if (module_exists('i18nstrings')) { + $i18_identifier = "webform:webform:" . $c['name']; + i18nstrings_update($i18_identifier, $c['name']); + $component['name'] = i18nstrings($i18_identifier, $c['name']); + } $component['type'] = $c['type']; $component['value'] = $c['value']; $component['extra'] = unserialize($c['extra']); @@ -2971,3 +2975,13 @@ return $form_info; } + +/** + * implementation of hook_locale + */ +function webform_locale($op = 'groups', $group = NULL) { + switch ($op) { + case 'groups': + return array('webform' => t('Webform labels')); + } +}