Index: privatemsg.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/privatemsg/privatemsg.module,v
retrieving revision 1.88
diff -u -p -r1.88 privatemsg.module
--- privatemsg.module	20 Sep 2008 20:22:20 -0000	1.88
+++ privatemsg.module	25 Sep 2008 21:32:30 -0000
@@ -202,11 +202,12 @@ function privatemsg_preprocess_privatems
   }
 
   $participants = implode(', ', $to);
-  if (drupal_strlen($participants)) {
-    $participants .= " and ";
+  if (empty($participants)) {
+    $vars['participants'] = t("From !last", array('!last' => $last));
+    return;
   }
 
-  $vars['participants'] = 'Between '. $participants . $last;
+  $vars['participants'] = t('Between !participants and !last',array('!participants' => $participants, '!last' => $last));
 }
 
 /**
@@ -230,7 +231,7 @@ function privatemsg_list($uid = NULL) {
       $account = user_load(array('uid' => $uid));
     }
     else { // We tried viewing someone else's messages but didn't have sufficient rights.
-      drupal_set_message("You do not have sufficient rights to view someone else's messages", WATCHDOG_WARNING);
+      drupal_set_message(t("You do not have sufficient rights to view someone else's messages"), WATCHDOG_WARNING);
       $account = $user;
     }
   }
@@ -263,18 +264,22 @@ function privatemsg_list($uid = NULL) {
         case 'id':
           continue 2;
         case 'author':
-      	  $col = 'from';
+      	  $col = t('from');
       	  break;
         case 'recipient':
-          $col = 'to';
+          $col = t('to');
+          break;
+        case 'subject':
+          $col = t('subject');
           break;
         case 'timestamp':
-          $col = arg(1) == 'sent' ? 'sent' : 'received';
+          $col = arg(1) == 'sent' ? t('sent') : t('received');
           break;
         default:
-          $col = $index;
+          //t($variable) should not be used, but are there actually any indexes missing?
+          $col = t($index);
       }
-      $head[$index] =  array('data' => t($col), 'field' => $index, 'sort'=> 'desc');
+      $head[$index] =  array('data' => $col, 'field' => $index, 'sort'=> 'desc');
     }
     if (arg(1) == 'inbox') {
       $query = _privatemsg_assemble_query('privatemsg_list', $account);
@@ -317,7 +322,7 @@ function privatemsg_list($uid = NULL) {
   }
   else {
     $content = '';
-    drupal_set_message('No messages to display.');
+    drupal_set_message(t('No messages to display.'));
   }
 
 //  drupal_set_message('<pre>'. print_r(count($messages), 1) .'</pre>');
@@ -382,11 +387,11 @@ function privatemsg_set_new_status($acco
         $status = 'Read';
       }
       $total_marked = db_affected_rows();
-      $msg =  format_plural($total_marked, "1 message marked as <em>!status</em>", '@count messages marked as <em>!status</em>', array('!status' => $status));
+      $msg =  format_plural($total_marked, "1 message marked as %status", '@count messages marked as %status', array('%status' => $status));
       drupal_set_message($msg);
     }
     else {
-      drupal_set_message('An error has occured, please contact the site administrator.', 'error');
+      drupal_set_message(t('An error has occured, please contact the site administrator.'), 'error');
     }
     return '';
   }
@@ -485,12 +490,12 @@ function privatemsg_new(&$form_state, $u
   );
   $form['controls']['preview'] = array(
     '#type'               => 'submit',
-    '#value'              => 'Preview',
+    '#value'              => t('Preview'),
     '#submit'             => array('pm_preview'),
   );
   $form['controls']['submit'] = array(
     '#type'               => 'submit',
-    '#value'              => 'Send',
+    '#value'              => t('Send'),
     '#submit'             => array('pm_send'),
   );
   $form['controls']['cancel'] = array(
@@ -514,13 +519,13 @@ function pm_send_validate($form, &$form_
 //    return ;
 //  }
   if (empty($form_values['recipient'])) {
-    form_set_error('recipient', t("You must fill out the <em>!to</em> field.", array('!to' => $form['header']['recipient']['#title'])));
+    form_set_error('recipient', t("You must fill out the %to field.", array('%to' => $form['header']['recipient']['#title'])));
   }
   if (empty($form_values['subject'])) {
-    form_set_error('subject', t("You must fill out the <em>!subject</em> field.", array('!subject' => $form['header']['subject']['#title'])));
+    form_set_error('subject', t("You must fill out the %subject field.", array('%subject' => $form['header']['subject']['#title'])));
   }
   if (empty($form_values['body'])) {
-    form_set_error('body', t("You must fill out the <em>!body</em> field.", array('!body' => $form['content']['body']['#title'])));
+    form_set_error('body', t("You must fill out the %body field.", array('%body' => $form['content']['body']['#title'])));
   }
 //  drupal_set_message('<pre>'. print_r($form, 1). '</pre>');
 //  drupal_set_message('<pre>'. print_r($form_state, 1). '</pre>');
@@ -590,7 +595,7 @@ function pm_send_validate($form, &$form_
 
   $form_state['validate_built_message'] = $message;
   if (!empty($invalid)) {
-    drupal_set_message('The following users will not receive this private message: '. check_plain(implode(", ", $invalid)), 'error');
+    drupal_set_message(t('The following users will not receive this private message: %users', array('%users' => check_plain(implode(", ", $invalid)), 'error')));
   }
 }
 
@@ -623,7 +628,7 @@ function pm_send($form, &$form_state) {
     db_query($query, $mid, $thread_id, $recipient->uid, $message['author']->uid , $timestamp);
   }
 
-  drupal_set_message('A private message has been sent to '. $form_state['values']['recipient']);
+  drupal_set_message(t('A private message has been sent to %recipient', array('%recipient' => $form_state['values']['recipient'])));
 }
 
 function privatemsg_render_preview($message) {
@@ -854,17 +859,14 @@ function privatemsg_user($op, &$edit, &$
     case 'view':
       $account->content['privatemsg_send_new_message'] = array(
         '#type'   => 'markup',
-        '#value'  => l('Send this user a private message', 'messages/new/'. $account->uid, array('query' => 'destination='. $_GET['q'])),
+        '#value'  => l(t('Send this user a private message'), 'messages/new/'. $account->uid, array('query' => 'destination='. $_GET['q'])),
         '#weight' => 10,
       );
       break;
     case 'login':
       $count = privatemsg_unread_count();
       if ($count) {
-        $login_msg = 'You have '. $count .' unread ';
-        $login_msg .= $count > 1 ? l('private messages', 'messages/inbox') : l('private message', 'messages/inbox');
-        $login_msg .= '.';
-        drupal_set_message(t($login_msg));
+        drupal_set_message(format_plural($count, 'You have one unread private message', 'You have @count unread private messages'));
       }
       break;
   }
@@ -889,11 +891,11 @@ function privatemsg_block($op = 'list', 
           $new = " ({$count})";
         }
         $links = array();
-        $links[] = l('Create private message', 'messages/new');
-        $links[] = l('Inbox'. $new, 'messages/inbox');
-        $links[] = l('Sent', 'messages/sent');
+        $links[] = l(t('Create private message'), 'messages/new');
+        $links[] = l(t('Inbox'). $new, 'messages/inbox');
+        $links[] = l(t('Sent'), 'messages/sent');
         $block = array(
-          'subject' => 'Private messages',
+          'subject' => t('Private messages'),
           'content' => theme('item_list', $links),
         );
         break;
@@ -943,7 +945,7 @@ function privatemsg_form_alter(&$form, $
         );
         $form['content']['body'] = array(
           '#type' => 'textarea',
-          '#title' => t('Send reply to ' . $recipient),
+          '#title' => t('Send reply to %recipient', array('%recipient' => $recipient)),
           '#cols' => 10,
           '#rows' => 6,
           '#default_value' => isset($form_state['values']['body'])? $form_state['values']['body']: '',
@@ -954,4 +956,4 @@ function privatemsg_form_alter(&$form, $
       }
     break;
   }
-}
\ No newline at end of file
+}
