Index: bp-core.php
===================================================================
--- bp-core.php	(revision 141)
+++ bp-core.php	(working copy)
@@ -1,5 +1,4 @@
 <?php
-
 require_once( ABSPATH . 'wp-content/mu-plugins/bp-core/bp-core-thirdlevel.php' );
 require_once( ABSPATH . 'wp-content/mu-plugins/bp-core/bp-core-settingstab.php' );
 require_once( ABSPATH . 'wp-content/mu-plugins/bp-core/bp-core-pagination.php' );
@@ -26,7 +25,7 @@
 }
 
 function buddypress_blog_switcher( $contents ) {
-	global $current_user, $blog_id; // current blog
+	global $current_user; // current blog
 	
 	// This code is duplicated from the MU core so it can
 	// be modified for BuddyPress.
@@ -39,7 +38,7 @@
 
 	$primary_blog = get_usermeta( $current_user->ID, 'primary_blog' );
 	
-	foreach ( $blogs = get_blogs_of_user( $current_user->ID ) as $blog ) {
+	foreach ( (array) get_blogs_of_user( $current_user->ID ) as $blog ) {
 		if ( !$blog->blogname )
 			continue;
 
@@ -119,7 +118,7 @@
 }
 
 function add_settings_tab() {
-	add_submenu_page( 'wpmu-admin.php', "BuddyPress", "BuddyPress", 1, basename(__FILE__), "core_admin_settings" );
+	add_submenu_page( 'wpmu-admin.php', __("BuddyPress"), __("BuddyPress"), 1, basename(__FILE__), "core_admin_settings" );
 }
 add_action( 'admin_menu', 'add_settings_tab' );
 
@@ -145,17 +144,17 @@
 			<th scope="row" valign="top">Tabs</th>
 			<td>
 				<input type="checkbox" value="1" name="disable_blog_tab"<?php echo $blog_tab_checked; ?> />
-				<label for="disable_blog_tab"> Disable merging of 'Write', 'Manage' and 'Comments' into one 'Blog' tab.</label>
+				<label for="disable_blog_tab"><?php _e("Disable merging of 'Write', 'Manage' and 'Comments' into one 'Blog' tab."); ?></label>
 				<br />
 				<input type="checkbox" value="1" name="disable_design_tab"<?php echo $design_tab_checked; ?> />
-				<label for="disable_design_tab"> Disable 'Design' tab for all members except site administrators.</label>
+				<label for="disable_design_tab"><?php _e("Disable 'Design' tab for all members except site administrators."); ?></label>
 			</td>
 			</tr>
 			</tbody>
 			</table>
 
 			<p class="submit">
-				  <input name="submit" value="Save Changes" type="submit" />
+				  <input name="submit" value="<?php _e("Save Changes"); ?> type="submit" />
 			</p>
 		
 			<input type="hidden" name="save_admin_settings" value="1" />
@@ -218,7 +217,7 @@
 	if ( is_site_admin() ) {	
 		$dash .= '
 			
-			<h4>Admin Options</h4>
+			<h4>' . __("Admin Options") . '</h4>
 			<ul>
 				<li><a href="wpmu-blogs.php">' . __("Manage Site Members") . '</a></li>
 				<li><a href="wpmu-options.php">' . __("Manage Site Options") . '</a></li>
@@ -243,7 +242,7 @@
 	global $userdata;
 	
 	if ( $uid == $userdata->ID )
-		return 'You';
+		return __('You');
 	
 	$ud = get_userdata($uid);
 	return $ud->user_login;	
@@ -267,7 +266,7 @@
 	$display_name = $ud->display_name;
 	
 	if ( $uid == $userdata->ID )
-		$display_name = 'You';
+		$display_name = __('You');
 
 	return '<a href="http://' . $ud->source_domain . '">' . $display_name . '</a>';
 	
@@ -306,6 +305,7 @@
 	return true;
 }
 
+// Todo Internationalize Date
 function bp_format_time( $time, $just_date = false ) {
 	$date = date( "F j, Y ", $time );
 	
@@ -400,15 +400,15 @@
 	
 	// create the date string
 	if ( date( "m", $timestamp ) == date("m") && date( "d", $timestamp ) == date("d") - 1 && date( "Y", $timestamp ) == date("Y") ) {
-		return "yesterday at " . date( "g:i a", $timestamp );
+		return sprintf( __("yesterday at %s"), date( "g:i a", $timestamp ));
 	} else if ( date( "m", $timestamp ) == date("m") && date( "d", $timestamp ) == date("d") && date( "Y", $timestamp ) == date("Y") ) {
-		return "at " . date( "g:i a", $timestamp );
+		return sprintf( __("at %s"), date( "g:i a", $timestamp ));
 	} else if ( date( "m", $timestamp) == date("m") && date( "d", $timestamp ) > date("d") - 5 && date( "Y", $timestamp ) == date("Y") ) {
-		return "on " . date( "l", $timestamp ) . " at " . date( "g:i a", $timestamp );
+		return sprintf( __("on %1s at %2s"), date( "l", $timestamp ), date( "g:i a", $timestamp ));
 	} else if ( date( "Y", $timestamp) == date("Y") ) {
-		return "on " . date( "F jS", $timestamp );
+		return sprintf( __("on %s"), date( "F jS", $timestamp ));
 	} else {
-		return "on " . date( "F jS Y", $timestamp );
+		return sprintf( __("on %s"), date( "F jS Y", $timestamp ));
 	}
 }
 
Index: bp-friends.php
===================================================================
--- bp-friends.php	(revision 141)
+++ bp-friends.php	(working copy)
@@ -1,5 +1,5 @@
 <?php
-
+global $wpdb;
 $bp_friends_table_name = $wpdb->base_prefix . 'bp_friends';
 $bp_friends_image_base = get_option('siteurl') . '/wp-content/mu-plugins/bp-friends/images';
 define( 'BP_FRIENDS_VERSION', '0.2' );
@@ -15,7 +15,7 @@
  **************************************************************************/
 
 function friends_install( $version ) {
-	global $wpdb, $bp_friends_table_name;
+	global $bp_friends_table_name;
 
 	$sql = array();
 			
@@ -43,7 +43,7 @@
  **************************************************************************/
 
 function friends_add_menu() {	
-	global $wpdb, $bp_friends_table_name, $bp_friends, $userdata;
+	global $wpdb, $bp_friends_table_name, $userdata;
 	
 	if ( $wpdb->blogid == $userdata->primary_blog ) {
 		add_menu_page( __("Friends"), __("Friends"), 1, basename(__FILE__), "friends_list" );
@@ -83,7 +83,7 @@
  **************************************************************************/
 
 function friends_template() {	
-	global $is_author, $userdata, $authordata, $friends_template;
+	global $friends_template;
 	
 	$friends_template = new BP_Friends_Template;
 }
@@ -139,7 +139,7 @@
 	
 function friends_find( $type = "error", $message = "" ) {
 	if ( isset($_POST['searchterm']) && isset($_POST['search']) ) {
-		if ( $_POST['searchterm'] == "" ) {
+		if ( empty($_POST['searchterm']) ) {
 			$message = __("Please make sure you enter something to search for.");
 		} else if ( strlen($_POST['searchterm']) < 3 ) {
 			$message = __("Your search term must be longer than 3 letters otherwise you'll be here for years.");
@@ -174,14 +174,14 @@
 			</fieldset>
 			
 			<p>
-				<input type="submit" value="<?php _e("Search") ?> &raquo;" name="search" id="search" style="font-weight: bold" />
+				<input type="submit" value="<?php _e("Search"); ?> &raquo;" name="search" id="search" style="font-weight: bold" />
 			</p>
 			
 		</form>
 		
 		<?php if ( isset($results) ) { ?>
 			<?php if (!$results) { ?>
-				<p>Nothing Found!</p>
+				<p><?php _e("Nothing Found!"); ?></p>
 			<?php } else { ?>
 				<ul id="friend_results">
 					<?php for ( $i = 0; $i < count($results); $i++ ) { ?>
Index: bp-groups.php
===================================================================
--- bp-groups.php	(revision 141)
+++ bp-groups.php	(working copy)
@@ -2,6 +2,7 @@
 
 add_site_option('bp-groups-version', '0.1');
 
+global $wpdb;
 $bp_groups_table_name = $wpdb->base_prefix . "bp_groups";
 $bp_group_members_table_name = $wpdb->base_prefix . "bp_group_members";
 
Index: bp-messages.php
===================================================================
--- bp-messages.php	(revision 141)
+++ bp-messages.php	(working copy)
@@ -2,6 +2,7 @@
 
 define ( 'BP_MESSAGES_VERSION', '0.2' );
 
+global $wpdb;
 $bp_messages_table_name = $wpdb->base_prefix . 'bp_messages';
 $bp_messages_table_name_deleted = $bp_messages_table_name . '_deleted';
 $bp_messages_image_base = get_option('siteurl') . '/wp-content/mu-plugins/bp-messages/images';
@@ -22,7 +23,7 @@
  **************************************************************************/
 
 function messages_install( $version ) {
-	global $wpdb, $bp_messages_table_name, $bp_messages_table_name_deleted;
+	global $bp_messages_table_name, $bp_messages_table_name_deleted;
 
 	$sql[] = "CREATE TABLE ". $bp_messages_table_name ." (
 		  		id int(11) NOT NULL AUTO_INCREMENT,
@@ -59,7 +60,7 @@
  **************************************************************************/
 
 function messages_add_menu() {	
-	global $wpdb, $bp_messages_table_name, $bp_messages, $userdata;
+	global $wpdb, $bp_messages_table_name, $userdata;
 
 	if ( $wpdb->blogid == $userdata->primary_blog ) {	
 		if ( $inbox_count = BP_Messages_Thread::get_inbox_count() ) {
@@ -118,7 +119,7 @@
 		<div id="poststuff">
 			<p>			
 			<div id="titlediv">
-				<h3><?php _e("Send To") ?> <small>(Use username - autocomplete coming soon)</small></h3>
+				<h3><?php _e("Send To <small>(Use username - autocomplete coming soon)</small>") ?> </h3>
 				<div id="titlewrap">
 					<input type="text" name="send_to" id="send_to" value="<?php echo $username; ?>" style="border: none; width: 99%" />
 				</div>
@@ -211,10 +212,10 @@
 			foreach ( $threads as $thread ) {
 				if ( $thread->messages ) {
 					if ( $thread->unread_count ) { 
-						$is_read = '<img src="' . $bp_messages_image_base .'/email.gif" alt="New Message" /><a href="admin.php?page=bp-messages.php&amp;mode=view&amp;thread_id=' . $thread->thread_id . '"><span id="awaiting-mod" class="count-1"><span class="message-count">' . $thread->unread_count . '</span></span></a>';
+						$is_read = '<img src="' . $bp_messages_image_base .'/email.gif" alt="'.__("New Message").'" /><a href="admin.php?page=bp-messages.php&amp;mode=view&amp;thread_id=' . $thread->thread_id . '"><span id="awaiting-mod" class="count-1"><span class="message-count">' . $thread->unread_count . '</span></span></a>';
 						$new = " unread";
 					} else { 
-						$is_read = '<img src="' . $bp_messages_image_base .'/email_open.gif" alt="Older Message" />'; 
+						$is_read = '<img src="' . $bp_messages_image_base .'/email_open.gif" alt="'.__("Older Message").'" />'; 
 					}
 					
 					if ( $counter % 2 == 0 ) 
@@ -229,9 +230,9 @@
 							</td>
 							<td class="sender-details">
 								<?php if ( $box == 'sentbox') { ?>
-									<h3>To: <?php echo $thread->recipients ?></h3>
+									<h3><?php printf( __("To: %s"), $thread->recipients); ?></h3>
 								<?php } else { ?>
-									<h3>From: <?php echo bp_core_get_userlink($thread->creator_id) ?></h3>
+									<h3><?php printf( __("From: %s"), bp_core_get_userlink($thread->creator_id)); ?></h3>
 								<?php } ?>
 								<?php echo bp_format_time($thread->last_post_date) ?>
 							</td>
@@ -239,8 +240,8 @@
 								<h4><a href="admin.php?page=bp-messages.php&amp;mode=view&amp;thread_id=<?php echo $thread->thread_id ?>"><?php echo stripslashes($thread->subject) ?></a></h4>
 								<?php echo bp_create_excerpt($thread->message, 20); ?>
 							</td>
-							<td width="50"><a href="admin.php?page=bp-messages.php&amp;mode=view&amp;thread_id=<?php echo $thread->thread_id ?>">View</a></td>
-							<td width="50"><a href="admin.php?page=bp-messages.php&amp;mode=delete&amp;thread_id=<?php echo $thread->thread_id ?>">Delete</a></td>
+							<td width="50"><a href="admin.php?page=bp-messages.php&amp;mode=view&amp;thread_id=<?php echo $thread->thread_id ?>"><?php _e("View"); ?></a></td>
+							<td width="50"><a href="admin.php?page=bp-messages.php&amp;mode=delete&amp;thread_id=<?php echo $thread->thread_id ?>"><?php _e("Delete"); ?></a></td>
 							<td width="25"><input type="checkbox" name="thread_ids[]" value="<?php echo $thread->thread_id ?>" /></td>
 						</tr>
 					<?php
@@ -256,7 +257,7 @@
 				</tbody>
 				</table>
 				<p class="submit">
-					<input id="deletebookmarks" class="button" type="submit" onclick="return confirm(\'You are about to delete these messages permanently.\n[Cancel] to stop, [OK] to delete.\')" value="Delete Checked Messages &raquo;" name="deletebookmarks"/>
+					<input id="deletebookmarks" class="button" type="submit" onclick="return confirm(\'You are about to delete these messages permanently.\n[Cancel] to stop, [OK] to delete.\')" value="'.__("Delete Checked Messages &raquo;").'" name="deletebookmarks"/>
 				</p>
 				</form>	
 			</div>';
@@ -265,7 +266,7 @@
 			?>
 				<tr class="alternate">
 				<td colspan="7" style="text-align: center; padding: 15px 0;">
-					<?php _e('You have no messages in your'); echo ' ' . $display_name . '.'; ?>
+					<?php printf(__('You have no messages in your %s.'), $display_name); ?>
 				</td>
 				</tr>
 			<?php
@@ -286,8 +287,6 @@
  **************************************************************************/
 
 function messages_send_message($to_user, $subject, $content, $thread_id, $from_ajax = false) {
-	global $userdata;
-
 	if ( is_numeric($to_user) ) {
 		$to_username = bp_core_get_username($to_user);
 	} else {
@@ -332,6 +331,7 @@
 			}
 		}
 	}
+	return false;
 }
 
 /**************************************************************************
@@ -341,15 +341,13 @@
  **************************************************************************/
 
 function messages_delete_thread( $thread_ids, $box, $display_name ) {
-	global $wpdb;
-	
 	$type = 'success';
 	
 	if ( is_array($thread_ids) ) {
 		$message = __('Messages deleted successfully!');
 		
 		for ( $i = 0; $i < count($thread_ids); $i++ ) {
-			if ( !$status = BP_Messages_Thread::delete($thread_ids[$i]) ) {
+			if ( !BP_Messages_Thread::delete($thread_ids[$i]) ) {
 				$message = __('There was an error when deleting messages. Please try again.');
 				$type = 'error';
 			}
@@ -357,7 +355,7 @@
 	} else {
 		$message = __('Message deleted successfully!');
 		
-		if ( !$status = BP_Messages_Thread::delete($thread_ids) ) {
+		if ( !BP_Messages_Thread::delete($thread_ids) ) {
 			$message = __('There was an error when deleting that message. Please try again.');
 			$type = 'error';
 		}
@@ -385,9 +383,9 @@
 						<tr>
 							<td>
 								<img src="<?php echo $bp_messages_image_base ?>/email_open.gif" alt="Message" style="vertical-align: top;" /> &nbsp;
-								<?php _e('Sent by') ?> <?php echo bp_core_get_userlink($thread->creator_id) ?>
-								<?php _e('to') ?> <?php echo $thread->recipients ?>. 
-								<?php _e('Most recently on') ?> <?php echo bp_format_time($thread->last_post_date) ?>
+								<?php printf( __('Sent by %s'), bp_core_get_userlink($thread->creator_id)); ?>
+								<?php printf( __('to %s.'), $thread->recipients); ?>
+								<?php printf( __('Most recently on %s'), bp_format_time($thread->last_post_date)); ?>
 							</td>
 						</tr>
 					</tbody>
@@ -429,7 +427,7 @@
 								</div>
 							</div>
 							<p class="submit">
-								<input type="submit" name="send" value="Send Reply &raquo;" id="send_reply_button" />
+								<input type="submit" name="send" value="<?php _e("Send Reply &raquo;"); ?>" id="send_reply_button" />
 							</p>
 					</div>
 					<?php if ( function_exists('wp_nonce_field') )
Index: bp-xprofile.php
===================================================================
--- bp-xprofile.php	(revision 141)
+++ bp-xprofile.php	(working copy)
@@ -2,6 +2,7 @@
 
 define ( 'BP_XPROFILE_VERSION', '0.2.3' );
 
+global $wpdb;
 $bp_xprofile_table_name        = $wpdb->base_prefix . 'bp_xprofile';
 $bp_xprofile_table_name_groups = $wpdb->base_prefix . 'bp_xprofile_groups';
 $bp_xprofile_table_name_fields = $wpdb->base_prefix . 'bp_xprofile_fields';
@@ -88,7 +89,7 @@
  **************************************************************************/
 
 function xprofile_add_menu() {
-	global $wpdb, $bp_xprofile_table_name, $bp_xprofile, $groups, $userdata;
+	global $wpdb, $bp_xprofile_table_name, $groups, $userdata;
 	
 	if ( $wpdb->blogid == $userdata->primary_blog ) {
 		add_menu_page( __('Profile'), __('Profile'), 1, basename(__FILE__), 'xprofile_avatar_admin' );
@@ -172,7 +173,7 @@
 ?>
 	<div class="wrap">
 		
-		<h2><?php echo $group->name ?> <?php _e("Information") ?></h2>
+		<h2><?php printf(__("%s Information"), $group->name); ?></h2>
 		
 		<?php
 			if ( $group->fields ) {
@@ -292,7 +293,7 @@
 ?>
 	<div class="wrap">
 		<h2><?php _e('Profile Settings'); ?></h2>
-		<p>Member profile settings will appear here.</p>
+		<p><?php _e('Member profile settings will appear here.'); ?></p>
 	</div>
 <?php
 }
