From 8682ab700718e95968d6a0d372ad769623404e1b Mon Sep 17 00:00:00 2001 From: ryan Date: Fri, 25 Mar 2005 21:41:45 +0000 Subject: [PATCH] Localize email messages. http://mosquito.wordpress.org/view.php?id=1168 Props: slebog git-svn-id: http://svn.automattic.com/wordpress/trunk@2477 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/users.php | 7 +-- wp-includes/comment-functions.php | 82 ++++++++++++++----------------- wp-includes/functions.php | 6 +-- wp-login.php | 23 ++++----- wp-register.php | 8 +-- 5 files changed, 62 insertions(+), 64 deletions(-) diff --git a/wp-admin/users.php b/wp-admin/users.php index 1b3206f70e..fb0fd4f8e1 100644 --- a/wp-admin/users.php +++ b/wp-admin/users.php @@ -81,10 +81,11 @@ case 'adduser': $stars .= '*'; $user_login = stripslashes($user_login); - $message = 'New user registration on your blog ' . get_settings('blogname') . ":\r\n\r\n"; - $message .= "Username: $user_login\r\n\r\nE-mail: $user_email"; + $message = sprintf(__('New user registration on your blog %s:'), get_settings('blogname')) . "\r\n\r\n"; + $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; + $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n"; - @wp_mail(get_settings('admin_email'), '[' . get_settings('blogname') . '] New User Registration', $message); + @wp_mail(get_settings('admin_email'), sprintf(__('[%s] New User Registration'), get_settings('blogname')), $message); header('Location: users.php'); break; diff --git a/wp-includes/comment-functions.php b/wp-includes/comment-functions.php index 06736a3549..f5967a274f 100644 --- a/wp-includes/comment-functions.php +++ b/wp-includes/comment-functions.php @@ -631,31 +631,31 @@ function wp_notify_postauthor($comment_id, $comment_type='') { if ( empty( $comment_type ) ) $comment_type = 'comment'; if ('comment' == $comment_type) { - $notify_message = "New comment on your post #$comment->comment_post_ID \"".$post->post_title."\"\r\n\r\n"; - $notify_message .= "Author : $comment->comment_author (IP: $comment->comment_author_IP , $comment_author_domain)\r\n"; - $notify_message .= "E-mail : $comment->comment_author_email\r\n"; - $notify_message .= "URI : $comment->comment_author_url\r\n"; - $notify_message .= "Whois : http://ws.arin.net/cgi-bin/whois.pl?queryinput=$comment->comment_author_IP\r\n"; - $notify_message .= "Comment:\r\n $comment->comment_content \r\n\r\n"; - $notify_message .= "You can see all comments on this post here: \r\n"; - $subject = '[' . $blogname . '] Comment: "' .$post->post_title.'"'; + $notify_message = sprintf( __('New comment on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n"; + $notify_message .= sprintf( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; + $notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\r\n"; + $notify_message .= sprintf( __('URI : %s'), $comment->comment_author_url ) . "\r\n"; + $notify_message .= sprintf( __('Whois : http://ws.arin.net/cgi-bin/whois.pl?queryinput=%s'), $comment->comment_author_IP ) . "\r\n"; + $notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n"; + $notify_message .= __('You can see all comments on this post here: ') . "\r\n"; + $subject = sprintf( __('[%1$s] Comment: "%2$s"'), $blogname, $post->post_title ); } elseif ('trackback' == $comment_type) { - $notify_message = "New trackback on your post #$comment_post_ID \"".$post->post_title."\"\r\n\r\n"; - $notify_message .= "Website: $comment->comment_author (IP: $comment->comment_author_IP , $comment_author_domain)\r\n"; - $notify_message .= "URI : $comment->comment_author_url\r\n"; - $notify_message .= "Excerpt: \n $comment->comment_content \r\n\r\n"; - $notify_message .= "You can see all trackbacks on this post here: \r\n"; - $subject = '[' . $blogname . '] Trackback: "' .$post->post_title.'"'; + $notify_message = sprintf( __('New trackback on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n"; + $notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; + $notify_message .= sprintf( __('URI : %s'), $comment->comment_author_url ) . "\r\n"; + $notify_message .= __('Excerpt: ') . "\r\n" . $comment->comment_content . "\r\n\r\n"; + $notify_message .= __('You can see all trackbacks on this post here: ') . "\r\n"; + $subject = sprintf( __('[%1$s] Trackback: "%2$s"'), $blogname, $post->post_title ); } elseif ('pingback' == $comment_type) { - $notify_message = "New pingback on your post #$comment_post_ID \"".$post->post_title."\"\r\n\r\n"; - $notify_message .= "Website: $comment->comment_author\r\n"; - $notify_message .= "URI : $comment->comment_author_url\r\n"; - $notify_message .= "Excerpt: \n[...] $comment->comment_content [...]\r\n\r\n"; - $notify_message .= "You can see all pingbacks on this post here: \r\n"; - $subject = '[' . $blogname . '] Pingback: "' .$post->post_title.'"'; + $notify_message = sprintf( __('New pingback on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n"; + $notify_message .= sprintf( __('Website: %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; + $notify_message .= sprintf( __('URI : %s'), $comment->comment_author_url ) . "\r\n"; + $notify_message .= __('Excerpt: ') . "\r\n" . sprintf( __('[...] %s [...]'), $comment->comment_content ) . "\r\n\r\n"; + $notify_message .= __('You can see all pingbacks on this post here: ') . "\r\n"; + $subject = sprintf( __('[%1$s] Pingback: "%2$s"'), $blogname, $post->post_title ); } - $notify_message .= get_permalink($comment->comment_post_ID) . '#comments'; - $notify_message .= "\r\n\r\nTo delete this comment:\r\n" . get_settings('siteurl') . "/wp-admin/post.php?action=confirmdeletecomment&p=".$comment->comment_post_ID."&comment=$comment_id"; + $notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n"; + $notify_message .= sprintf( __('To delete this comment, visit: %s'), get_settings('siteurl').'/wp-admin/post.php?action=confirmdeletecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n"; if ('' == $comment->comment_author_email || '' == $comment->comment_author) { $from = "From: \"$blogname\" '; @@ -663,9 +663,9 @@ function wp_notify_postauthor($comment_id, $comment_type='') { $from = 'From: "' . $comment->comment_author . "\" <$comment->comment_author_email>"; } - $message_headers = "MIME-Version: 1.0\n" - . "$from\n" - . "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n"; + $message_headers = "MIME-Version: 1.0\r\n" + . "$from\r\n" + . "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\r\n"; @wp_mail($user->user_email, $subject, $notify_message, $message_headers); @@ -692,27 +692,21 @@ function wp_notify_moderator($comment_id) { $comment_author_domain = gethostbyaddr($comment->comment_author_IP); $comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'"); - $notify_message = "A new comment on the post #$post->ID \"$post->post_title\" is waiting for your approval\r\n"; - $notify_message .= get_permalink($comment->comment_post_ID); - $notify_message .= "\n\nAuthor : $comment->comment_author (IP: $comment->comment_author_IP , $comment_author_domain)\r\n"; - $notify_message .= "E-mail : $comment->comment_author_email\r\n"; - $notify_message .= "URL : $comment->comment_author_url\r\n"; - $notify_message .= "Whois : http://ws.arin.net/cgi-bin/whois.pl?queryinput=$comment->comment_author_IP\r\n"; - $notify_message .= "Comment:\r\n".$comment->comment_content."\r\n\r\n"; - $notify_message .= "To approve this comment, visit: " . get_settings('siteurl') . "/wp-admin/post.php?action=mailapprovecomment&p=".$comment->comment_post_ID."&comment=$comment_id\r\n"; - $notify_message .= "To delete this comment, visit: " . get_settings('siteurl') . "/wp-admin/post.php?action=confirmdeletecomment&p=".$comment->comment_post_ID."&comment=$comment_id\r\n"; - $notify_message .= "Currently $comments_waiting comments are waiting for approval. Please visit the moderation panel:\r\n"; - $notify_message .= get_settings('siteurl') . "/wp-admin/moderation.php\r\n"; + $notify_message = sprintf( __('A new comment on the post #%1$s "%2$s" is waiting for your approval'), $post->ID, $post->post_title ) . "\r\n"; + $notify_message .= get_permalink($comment->comment_post_ID) . "\r\n\r\n"; + $notify_message .= sprintf( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; + $notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\r\n"; + $notify_message .= sprintf( __('URI : %s'), $comment->comment_author_url ) . "\r\n"; + $notify_message .= sprintf( __('Whois : http://ws.arin.net/cgi-bin/whois.pl?queryinput=%s'), $comment->comment_author_IP ) . "\r\n"; + $notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n"; + $notify_message .= sprintf( __('To approve this comment, visit: %s'), get_settings('siteurl').'/wp-admin/post.php?action=mailapprovecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n"; + $notify_message .= sprintf( __('To delete this comment, visit: %s'), get_settings('siteurl').'/wp-admin/post.php?action=confirmdeletecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n"; + $notify_message .= sprintf( __('Currently %s comments are waiting for approval. Please visit the moderation panel:'), $comments_waiting ) . "\r\n"; + $notify_message .= get_settings('siteurl') . "/wp-admin/moderation.php\r\n"; - $subject = '[' . get_settings('blogname') . '] Please moderate: "' .$post->post_title.'"'; - $admin_email = get_settings("admin_email"); - $from = "From: $admin_email"; + $subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), get_settings('blogname'), $post->post_title ); - $message_headers = "MIME-Version: 1.0\n" - . "$from\n" - . "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n"; - - @wp_mail($admin_email, $subject, $notify_message, $message_headers); + @wp_mail($admin_email, $subject, $notify_message); return true; } diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 20de180381..f73a19a543 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1653,9 +1653,9 @@ function htmlentities2($myHTML) { function wp_mail($to, $subject, $message, $headers = '') { if( $headers == '' ) { - $headers = "MIME-Version: 1.0\n" . - "From: " . get_settings('admin_email') . "\n" . - "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n"; + $headers = "MIME-Version: 1.0\r\n" . + "From: " . get_settings('admin_email') . "\r\n" . + "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\r\n"; } return @mail($to, $subject, $message, $headers); diff --git a/wp-login.php b/wp-login.php index 38131c8eaa..36ad3f9446 100644 --- a/wp-login.php +++ b/wp-login.php @@ -102,13 +102,13 @@ do_action('retrieve_password', $user_login); $key = substr( md5( uniqid( microtime() ) ), 0, 50); // now insert the new pass md5'd into the db $wpdb->query("UPDATE $wpdb->users SET user_activation_key = '$key' WHERE user_login = '$user_login'"); - $message .= __("Someone has asked to reset the password for the following site and username.\n\n"); - $message .= get_option('siteurl') . "\n\n"; + $message .= __('Someone has asked to reset the password for the following site and username.') . "\r\n\r\n"; + $message .= get_option('siteurl') . "\r\n\r\n"; $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; - $message .= __("To reset your password visit the following address, otherwise just ignore this email and nothing will happen.\n\n"); - $message .= get_settings('siteurl') . "/wp-login.php?action=resetpass&key=$key"; + $message .= __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . "\r\n\r\n"; + $message .= get_settings('siteurl') . "/wp-login.php?action=resetpass&key=$key\r\n"; - $m = wp_mail($user_email, sprintf(__("[%s] Password Reset"), get_settings('blogname')), $message); + $m = wp_mail($user_email, sprintf(__('[%s] Password Reset'), get_settings('blogname')), $message); if ($m == false) { echo '

' . __('The e-mail could not be sent.') . "
\n"; @@ -138,19 +138,20 @@ case 'resetpass' : $wpdb->query("UPDATE $wpdb->users SET user_pass = MD5('$new_pass'), user_activation_key = '' WHERE user_login = '$user->user_login'"); $message = sprintf(__('Username: %s'), $user->user_login) . "\r\n"; $message .= sprintf(__('Password: %s'), $new_pass) . "\r\n"; - $message .= get_settings('siteurl') . '/wp-login.php'; + $message .= get_settings('siteurl') . "/wp-login.php\r\n"; - $m = wp_mail($user->user_email, sprintf(__("[%s] Your new password"), get_settings('blogname')), $message); + $m = wp_mail($user->user_email, sprintf(__('[%s] Your new password'), get_settings('blogname')), $message); if ($m == false) { - echo '

' . __('The e-mail could not be sent.') . "
\n"; - echo __('Possible reason: your host may have disabled the mail() function...') . "

"; + echo '

' . __('The e-mail could not be sent.') . "
\n"; + echo __('Possible reason: your host may have disabled the mail() function...') . '

'; die(); } else { - echo '

' . sprintf(__("Your new password is in the mail."), $user_login) . '
'; + echo '

' . sprintf(__('Your new password is in the mail.'), $user_login) . '
'; echo "" . __('Click here to login!') . '

'; // send a copy of password change notification to the admin - wp_mail(get_settings('admin_email'), sprintf(__('[%s] Password Lost/Change'), get_settings('blogname')), sprintf(__('Password Lost and Changed for user: %s'), $user->user_login)); + $message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n"; + wp_mail(get_settings('admin_email'), sprintf(__('[%s] Password Lost/Change'), get_settings('blogname')), $message); die(); } break; diff --git a/wp-register.php b/wp-register.php index e8eac7ad0f..c7c4c8ff38 100644 --- a/wp-register.php +++ b/wp-register.php @@ -75,11 +75,13 @@ case 'register': $message = sprintf(__('Username: %s'), $user_login) . "\r\n"; $message .= sprintf(__('Password: %s'), $password) . "\r\n"; - $message .= get_settings('siteurl') . '/wp-login.php'; + $message .= get_settings('siteurl') . "/wp-login.php\r\n"; - wp_mail($user_email, sprintf(__("[%s] Your username and password"), get_settings('blogname')), $message); + wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_settings('blogname')), $message); - $message = sprintf(__("New user registration on your blog %1\$s:\n\nUsername: %2\$s \n\nE-mail: %3\$s"), get_settings('blogname'), $user_login, $user_email); + $message = sprintf(__('New user registration on your blog %s:'), get_settings('blogname')) . "\r\n\r\n"; + $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; + $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n"; @wp_mail(get_settings('admin_email'), sprintf(__('[%s] New User Registration'), get_settings('blogname')), $message);