Index: messaging.admin.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/messaging/Attic/messaging.admin.inc,v retrieving revision 1.1.2.13.2.2 diff -u -p -r1.1.2.13.2.2 messaging.admin.inc --- messaging.admin.inc 30 Apr 2009 10:42:35 -0000 1.1.2.13.2.2 +++ messaging.admin.inc 30 Aug 2009 16:56:01 -0000 @@ -139,7 +139,7 @@ function messaging_admin_message_form($f '#collapsed' => TRUE, ); foreach ($send_methods as $method => $methodname) { - $text = messaging_message_part($group, $key, $method, FALSE); + $text = messaging_message_part($group, $key, $method, FALSE, FALSE); $form['messages'][$key][$method] = array( '#title' => $methodname, '#type' => 'textarea', Index: messaging.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/messaging/messaging.module,v retrieving revision 1.7.2.8.2.27.2.6 diff -u -p -r1.7.2.8.2.27.2.6 messaging.module --- messaging.module 30 Apr 2009 10:42:35 -0000 1.7.2.8.2.27.2.6 +++ messaging.module 30 Aug 2009 17:21:17 -0000 @@ -591,11 +591,14 @@ function messaging_user_setting($name, $ * String the mailing method that should be used. OPTIONAL * @param $getdefault * Boolean, whether to use the default if a specific message isn't available for the used method. OPTIONAL, Defaults to true. + * @param $translate + * Boolean, whether to attempt to get the translation of the message when the i18nstrings module is installed. OPTIONAL, Defaults to true. + * This option is used internally to prevent message templates translations within the Messaging administration UI. * * @return * Assembled text of a message part. */ -function messaging_message_part($group, $key, $method = 'default', $getdefault = TRUE) { +function messaging_message_part($group, $key, $method = 'default', $getdefault = TRUE, $translate = TRUE) { static $cache; if (isset($cache[$group][$key][$method])) { $text_part = $cache[$group][$key][$method]; @@ -605,7 +608,7 @@ function messaging_message_part($group, } elseif ($method == 'default' && ($text = messaging_message_info($group, $key))) { // Retry with default but also set the cache for this method $text_part = $text; - } elseif ($method != 'default' && $getdefault && ($text = messaging_message_part($group, $key, 'default'))) { + } elseif ($method != 'default' && $getdefault && ($text = messaging_message_part($group, $key, 'default', $translate))) { $text_part = $text; } else { $text_part = FALSE; @@ -614,6 +617,9 @@ function messaging_message_part($group, if ($text_part && is_array($text_part)) { $text_part = implode("\n", $text_part); } + if (!empty($text_part) && $translate && module_exists('i18nstrings')) { + $text_part = tt('messaging:'. $group .':'. $key .':'. $method, $text_part); + } $cache[$group][$key][$method] = $text_part; } @@ -621,6 +627,38 @@ function messaging_message_part($group, } /** + * Implementation of hook_locale(). + */ +function messaging_locale($op = 'groups', $group = NULL) { + switch ($op) { + case 'groups': + return array('messaging' => t('Messaging')); + + case 'refresh': + if ($group == 'messaging') { + return messaging_locale_refresh(); + } + } +} + +/** + * Refresh locale strings. + */ +function messaging_locale_refresh() { + $groups = module_invoke_all('messaging', 'message groups'); + $send_methods = array('default' => t('Default')); + $send_methods += messaging_method_list(); + foreach (array_keys($groups) as $group) { + $keylist = module_invoke_all('messaging', 'message keys', $group); + foreach (array_keys($keylist) as $key) { + foreach (array_keys($send_methods) as $method) { + messaging_message_part($group, $key, $method, FALSE, FALSE); + } + } + } +} + +/** * Returns parts of messages, that may be formatted for each sending method * * @param $group