Index: signup.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/signup/signup.module,v retrieving revision 1.205.2.6 diff -u -p -r1.205.2.6 signup.module --- signup.module 20 Dec 2008 06:31:27 -0000 1.205.2.6 +++ signup.module 23 Dec 2008 21:18:14 -0000 @@ -59,6 +59,14 @@ function signup_theme() { 'data' => NULL, ), ), + 'signup_custom_data_field_text' => array( + 'file' => 'email.inc', + 'path' => $path, + 'arguments' => array( + 'key' => NULL, + 'value' => NULL, + ), + ), 'signup_broadcast_sender_copy' => array( 'file' => 'email.inc', 'path' => $path, cvs diff: Diffing theme Index: theme/email.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/signup/theme/email.inc,v retrieving revision 1.1 diff -u -p -r1.1 email.inc --- theme/email.inc 12 Nov 2008 23:22:19 -0000 1.1 +++ theme/email.inc 23 Dec 2008 21:18:14 -0000 @@ -45,13 +45,36 @@ function theme_signup_custom_data_email( $output .= "\n\r". call_user_func(__FUNCTION__, $value) ."\n\r"; } else { - $output .= $key .': '. $value ."\n\r"; + $output .= theme('signup_custom_data_field_text', $key, $value) ."\n\r"; } } return $output; } /** + * Renders a single custom signup form field into unfiltered output. + * + * @param $key + * Name of the custom signup field (the array key). + * @param $value + * Value of the custom signup field (the array value). + * + * @return + * Plain text output to display this key/value pair. + * + * @see theme_signup_user_form() + */ +function theme_signup_custom_data_field_text($key, $value) { + // All of the possible array key values should already be translated as + // string literals in theme_signup_user_form() via the #title attributes, so + // passing a variable to t() is actually safe here. However, to avoid + // warnings when extracting strings, "hide" the call to t() by using a + // variable to hold the function name. + $tr = 't'; + return $tr($key) .': '. $value; +} + +/** * Controls the body of the copy of the broadcast message sent to the sender. * * @param $raw_message Index: theme/node.admin.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/signup/theme/node.admin.inc,v retrieving revision 1.4.2.2 diff -u -p -r1.4.2.2 node.admin.inc --- theme/node.admin.inc 20 Dec 2008 06:31:27 -0000 1.4.2.2 +++ theme/node.admin.inc 23 Dec 2008 21:18:15 -0000 @@ -110,6 +110,12 @@ function theme_signup_node_admin_details */ function theme_signup_custom_data($data) { $output = ''; + // All of the possible array key values should already be translated as + // string literals in theme_signup_user_form() via the #title attributes, so + // passing a variable to t() is actually safe here. However, to avoid + // warnings when extracting strings, "hide" the call to t() by using a + // variable to hold the function name. + $tr = 't'; // Loop through each first level element. foreach ($data as $key => $value) { $output .= '
'; @@ -119,7 +125,7 @@ function theme_signup_custom_data($data) $output .= call_user_func(__FUNCTION__, $value); } else { - $output .= $key .': '. check_plain($value); + $output .= $tr($key) .': '. check_plain($value); } $output .= "
\n"; } Index: theme/node.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/signup/theme/node.inc,v retrieving revision 1.1 diff -u -p -r1.1 node.inc --- theme/node.inc 12 Nov 2008 23:22:19 -0000 1.1 +++ theme/node.inc 23 Dec 2008 21:18:15 -0000 @@ -116,6 +116,12 @@ function theme_signup_custom_data_table( */ function theme_signup_custom_data_rows($data) { $rows = array(); + // All of the possible array key values should already be translated as + // string literals in theme_signup_user_form() via the #title attributes, so + // passing a variable to t() is actually safe here. However, to avoid + // warnings when extracting strings, "hide" the call to t() by using a + // variable to hold the function name. + $tr = 't'; // Loop through each first level element. foreach ($data as $key => $value) { if (is_array($value)) { @@ -124,7 +130,7 @@ function theme_signup_custom_data_rows($ $rows += call_user_func(__FUNCTION__, $value); } else { - $rows[] = array($key .':', check_plain($value)); + $rows[] = array($tr($key) .':', check_plain($value)); } } return $rows; Index: theme/signup_form.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/signup/theme/signup_form.inc,v retrieving revision 1.3 diff -u -p -r1.3 signup_form.inc --- theme/signup_form.inc 19 Nov 2008 18:35:11 -0000 1.3 +++ theme/signup_form.inc 23 Dec 2008 21:18:15 -0000 @@ -19,12 +19,14 @@ * 'Name' field in this function, you will probably have to implement a * version of theme_signup_email_token_anonymous_username() for your site. * - * In order for the form to be rendered properly, the name of the form - * element must be $form['signup_form_data']['NameOfDataField'], where - * NameOfDataField is replaced with the actual name of the data field. - * We suggest that the displayed name of the field (the '#title' - * property) be the same as the name of the data field, but it's not - * required. See below for examples. + * In order for the form to be rendered properly and for the custom + * fields to be fully translatable when printed in other parts of the + * Signup module (displayed in signup lists, emails, etc), the name of + * the form element must be $form['signup_form_data']['NameOfDataField'], + * where NameOfDataField is replaced with the actual name of the data + * field. For translation to work, the displayed name of the field + * (the '#title' property) be the same as the name of the data field, + * but wrapped in t(). See below for examples. * * Fieldsets are not currently supported in this form. Any * '#default_value' will be filled in by default when the form is cvs diff: Diffing views cvs diff: Diffing views/handlers Index: views/handlers/signup_handler_field_signup_user_form_data.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/signup/views/handlers/signup_handler_field_signup_user_form_data.inc,v retrieving revision 1.1 diff -u -p -r1.1 signup_handler_field_signup_user_form_data.inc --- views/handlers/signup_handler_field_signup_user_form_data.inc 12 Nov 2008 01:00:58 -0000 1.1 +++ views/handlers/signup_handler_field_signup_user_form_data.inc 23 Dec 2008 21:18:15 -0000 @@ -10,18 +10,23 @@ class signup_handler_field_signup_user_f $form['form_data_fieldname'] = array( '#type' => 'textfield', '#title' => t(' Field Name'), - '#description' => t('If you want to display a single field from signup.theme, enter its name here, otherwise, all fields will be displayed.'), + '#description' => t('If you want to display a single field from the signup form (see theme/signup_form.inc), enter its name here. Otherwise, all fields will be displayed.'), '#default_value' => isset($this->options['form_data_fieldname']) ? $this->options['form_data_fieldname'] : '', ); } + /** + * Set each field value to "$key: $value" when rendering all fields. + * + * @see theme_signup_custom_data_field_text() + */ function pre_render($values) { if (!$this->options['form_data_fieldname']) { foreach ($values as $key => $result) { $form_data = unserialize($result->{$this->field_alias}); if ($form_data) { foreach ($form_data as $key => $value) { - $this->items[$result->{$this->field_alias}][$key] = check_plain($key .': '. $value); + $this->items[$result->{$this->field_alias}][$key] = check_plain(theme('signup_custom_data_field_text', $key, $value)); } } } cvs diff: Diffing views/plugins