Use __ngettext() for plurals. Props darkdragon. see #4865

git-svn-id: https://develop.svn.wordpress.org/trunk@6430 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2007-12-20 17:05:06 +00:00
parent 51bb6ffc85
commit d20eeb048b
14 changed files with 22 additions and 21 deletions

View File

@ -68,7 +68,7 @@ if ( !empty( $_POST['delete_comments'] ) ) :
endforeach;
echo '<div style="background-color: rgb(207, 235, 247);" id="message" class="updated fade"><p>';
if ( !empty( $_POST['spam_button'] ) ) {
printf(__ngettext('%s comment marked as spam', '%s comments marked as spam.', $i), $i);
printf(__ngettext('%s comment marked as spam.', '%s comments marked as spam.', $i), $i);
} else {
printf(__ngettext('%s comment deleted.', '%s comments deleted.', $i), $i);
}

View File

@ -141,7 +141,7 @@ class BW_Import {
}
if ( $num_comments ) {
echo ' ';
printf(__('(%s comments)'), $num_comments);
printf( __ngettext('%s comment', '%s comments', $num_comments), $num_comments );
}
echo '</li>';
flush();

View File

@ -68,7 +68,7 @@ class BunnyTags_Import {
return false;
} else {
$count = count($metakeys);
echo '<p>' . sprintf( __('Done! <strong>%s</strong> posts with tags were read.'), $count ) . '<br /></p>';
echo '<p>' . sprintf( __ngettext('Done! <strong>%s</strong> post with tags were read.', 'Done! <strong>%s</strong> posts with tags were read.', $count), $count ) . '<br /></p>';
echo '<ul>';
foreach ( $metakeys as $post_meta ) {
if ( $post_meta->meta_value != '' ) {

View File

@ -526,7 +526,7 @@ class Dotclear_Import {
}
add_option('dclinks2wplinks',$dclinks2wplinks);
echo '<p>';
printf(__('Done! <strong>%s</strong> links or link categories imported'), $count);
printf(__ngettext('Done! <strong>%s</strong> link or link category imported.', 'Done! <strong>%s</strong> links or link categories imported.', $count), $count);
echo '<br /><br /></p>';
return true;
}

View File

@ -272,12 +272,12 @@ class GM_Import {
}
if ($numAddedComments > 0) {
echo ': ';
printf(__('imported %d comment(s)'), $numAddedComments);
printf(__('imported %s'), sprintf( __ngettext('%s comment', '%s comments', $numAddedComments) , $numAddedComments) );
}
$preExisting = $numComments - numAddedComments;
if ($preExisting > 0) {
echo ' ';
printf(__('ignored %d pre-existing comments'), $preExisting);
printf(__('ignored %s'), sprintf( __ngettext( '%s pre-existing comment', '%s pre-existing comments', $preExisting ) , $preExisting) );
}
}
echo '... <strong>'.__('Done').'</strong></li>';

View File

@ -84,7 +84,7 @@ class JeromesKeyword_Import {
return false;
} else {
$count = count($metakeys);
echo '<p>' . sprintf( __('Done! <strong>%s</strong> posts with tags were read.'), $count ) . '<br /></p>';
echo '<p>' . sprintf( __ngettext('Done! <strong>%s</strong> post with tags were read.', 'Done! <strong>%s</strong> posts with tags were read.', $count), $count ) . '<br /></p>';
echo '<ul>';
foreach ( $metakeys as $post_meta ) {
if ( $post_meta->meta_value != '' ) {
@ -125,7 +125,7 @@ class JeromesKeyword_Import {
return false;
} else {
$count = count($metakeys);
echo '<p>' . sprintf( __('Done! <strong>%s</strong> tags were read.'), $count ) . '<br /></p>';
echo '<p>' . sprintf( __ngettext('Done! <strong>%s</strong> tag were read.', 'Done! <strong>%s</strong> tags were read.', $count), $count ) . '<br /></p>';
echo '<ul>';
foreach ( $metakeys as $post_meta ) {
$keyword = addslashes(trim($post_meta->tag_name));

View File

@ -119,7 +119,7 @@ class LJ_Import {
}
if ( $num_comments ) {
echo ' ';
printf(__('(%s comments)'), $num_comments);
printf(__ngettext('(%s comment)', '(%s comments)', $num_comments), $num_comments);
}
echo '</li>';
}

View File

@ -238,7 +238,7 @@ class MT_Import {
}
if ( $num_comments )
printf(' '.__('(%s comments)'), $num_comments);
printf(' '.__ngettext('(%s comment)', '(%s comments)', $num_comments), $num_comments);
$num_pings = 0;
foreach ( $pings as $ping ) {
@ -255,7 +255,7 @@ class MT_Import {
}
if ( $num_pings )
printf(' '.__('(%s pings)'), $num_pings);
printf(' '.__ngettext('(%s ping)', '(%s pings)', $num_pings), $num_pings);
echo "</li>";
//ob_flush();flush();

View File

@ -73,7 +73,7 @@ class STP_Import {
add_option('stpimp_posts', $posts);
$count = count($posts);
echo '<p>' . sprintf( __('Done! <strong>%s</strong> tag to post relationships were read.'), $count ) . '<br /></p>';
echo '<p>' . sprintf( __ngettext('Done! <strong>%s</strong> tag to post relationships were read.', 'Done! <strong>%s</strong> tags to post relationships were read.', $count), $count ) . '<br /></p>';
}
echo '<form action="admin.php?import=stp&amp;step=2" method="post">';
@ -91,7 +91,7 @@ class STP_Import {
// run that funky magic!
$tags_added = $this->tag2post();
echo '<p>' . sprintf( __('Done! <strong>%s</strong> tags where added!'), $tags_added ) . '<br /></p>';
echo '<p>' . sprintf( __ngettext('Done! <strong>%s</strong> tags where added!', 'Done! <strong>%s</strong> tags where added!', $tags_added), $tags_added ) . '<br /></p>';
echo '<form action="admin.php?import=stp&amp;step=3" method="post">';
wp_nonce_field('import-stp');
echo '<p class="submit"><input type="submit" name="submit" value="'.__('Step 3 &raquo;').'" /></p>';

View File

@ -462,7 +462,7 @@ class Textpattern_Import {
}
add_option('txplinks2wplinks',$txplinks2wplinks);
echo '<p>';
printf(__('Done! <strong>%s</strong> Links imported'), $count);
printf(__ngettext('Done! <strong>%s</strong> link imported', 'Done! <strong>%s</strong> links imported', $count), $count);
echo '<br /><br /></p>';
return true;
}

View File

@ -84,7 +84,7 @@ class UTW_Import {
$count = count($tags);
echo '<p>' . sprintf( __('Done! <strong>%s</strong> tags were read.'), $count ) . '<br /></p>';
echo '<p>' . sprintf( __ngettext('Done! <strong>%s</strong> tag were read.', 'Done! <strong>%s</strong> tags were read.', $count), $count ) . '<br /></p>';
echo '<p>' . __('The following tags were found:') . '</p>';
echo '<ul>';
@ -136,7 +136,7 @@ class UTW_Import {
$count = count($posts);
echo '<p>' . sprintf( __('Done! <strong>%s</strong> tag to post relationships were read.'), $count ) . '<br /></p>';
echo '<p>' . sprintf( __ngettext('Done! <strong>%s</strong> tag to post relationships were read.', 'Done! <strong>%s</strong> tags to post relationships were read.', $count), $count ) . '<br /></p>';
}
@ -157,7 +157,7 @@ class UTW_Import {
// run that funky magic!
$tags_added = $this->tag2post();
echo '<p>' . sprintf( __('Done! <strong>%s</strong> tags were added!'), $tags_added ) . '<br /></p>';
echo '<p>' . sprintf( __ngettext( 'Done! <strong>%s</strong> tag were added!', 'Done! <strong>%s</strong> tags were added!', $tags_added ), $tags_added ) . '<br /></p>';
echo '<form action="admin.php?import=utw&amp;step=4" method="post">';
wp_nonce_field('import-utw');

View File

@ -429,7 +429,7 @@ class WP_Import {
} }
if ( $num_comments )
printf(' '.__('(%s comments)'), $num_comments);
printf(' '.__ngettext('(%s comment)', '(%s comments)', $num_comments), $num_comments);
// Now for post meta
preg_match_all('|<wp:postmeta>(.*?)</wp:postmeta>|is', $post, $postmeta);

View File

@ -82,12 +82,12 @@ if ( isset( $_GET['approved'] ) || isset( $_GET['deleted'] ) || isset( $_GET['sp
echo '<div id="moderated" class="updated fade"><p>';
if ( $approved > 0 ) {
printf( __ngettext( '%s comment approved.', '%s comments approved.', $approved ), $approved );
printf( __ngettext( '%s comment approved', '%s comments approved', $approved ), $approved );
echo '<br />';
}
if ( $deleted > 0 ) {
printf( __ngettext( '%s comment deleted', '%s comments deleted.', $deleted ), $deleted );
printf( __ngettext( '%s comment deleted', '%s comments deleted', $deleted ), $deleted );
echo '<br />';
}

View File

@ -631,7 +631,8 @@ function wp_notify_moderator($comment_id) {
$notify_message .= sprintf( __('Approve it: %s'), get_option('siteurl')."/wp-admin/comment.php?action=mac&c=$comment_id" ) . "\r\n";
$notify_message .= sprintf( __('Delete it: %s'), get_option('siteurl')."/wp-admin/comment.php?action=cdc&c=$comment_id" ) . "\r\n";
$notify_message .= sprintf( __('Spam it: %s'), get_option('siteurl')."/wp-admin/comment.php?action=cdc&dt=spam&c=$comment_id" ) . "\r\n";
$notify_message .= sprintf( __('Currently %s comments are waiting for approval. Please visit the moderation panel:'), $comments_waiting ) . "\r\n";
$strCommentsPending = sprintf( __ngettext('%s comment', '%s comments', $comments_waiting), $comments_waiting );
$notify_message .= sprintf( __('Currently %s are waiting for approval. Please visit the moderation panel:'), $strCommentsPending ) . "\r\n";
$notify_message .= get_option('siteurl') . "/wp-admin/moderation.php\r\n";
$subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), get_option('blogname'), $post->post_title );