Fix various i18n issues on the dashboard. Limits it to posts and pages only for 3.8.

props SergeyBiryukov, dimadin.
fixes #26066.


git-svn-id: https://develop.svn.wordpress.org/trunk@26704 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2013-12-05 23:33:48 +00:00
parent 5454336667
commit a7ee089f6f

View File

@ -185,36 +185,32 @@ function wp_dashboard_right_now() {
<ul> <ul>
<?php <?php
do_action( 'rightnow_list_start' ); do_action( 'rightnow_list_start' );
// Using show_in_nav_menus as my arg for grabbing what post types should show, is there better? // Posts and Pages
$post_types = get_post_types( array( 'show_in_nav_menus' => true ), 'objects' ); foreach ( array( 'post', 'page' ) as $post_type ) {
$post_types = (array) apply_filters( 'rightnow_post_types', $post_types );
foreach ( $post_types as $post_type => $post_type_obj ){
$num_posts = wp_count_posts( $post_type ); $num_posts = wp_count_posts( $post_type );
if ( $num_posts && $num_posts->publish ) { if ( $num_posts && $num_posts->publish ) {
printf( if ( 'post' == $post_type ) {
'<li class="%1$s-count"><a href="edit.php?post_type=%1$s">%2$s %3$s</a></li>', $text = _n( '%s Post', '%s Posts', $num_posts->publish );
$post_type, } else {
number_format_i18n( $num_posts->publish ), $text = _n( '%s Page', '%s Pages', $num_posts->publish );
$post_type_obj->label }
); $text = sprintf( $text, number_format_i18n( $num_posts->publish ) );
printf( '<li class="%1$s-count"><a href="edit.php?post_type=%1$s">%2$s</a></li>', $post_type, $text );
} }
} }
// Comments // Comments
$num_comm = wp_count_comments(); $num_comm = wp_count_comments();
if ( $num_comm && $num_comm->total_comments ) { if ( $num_comm && $num_comm->total_comments ) {
$text = _n( 'comment', 'comments', $num_comm->total_comments ); $text = sprintf( _n( '%s Comment', '%s Comments', $num_comm->total_comments ), number_format_i18n( $num_comm->total_comments ) );
printf( ?>
'<li class="comment-count"><a href="edit-comments.php">%1$s %2$s</a></li>', <li class="comment-count"><a href="edit-comments.php"><?php echo $text; ?></a></li>
number_format_i18n( $num_comm->total_comments ), <?php
$text
);
if ( $num_comm->moderated ) { if ( $num_comm->moderated ) {
$text = _n( 'in moderation', 'in moderation', $num_comm->total_comments ); /* translators: Number of comments in moderation */
printf( $text = sprintf( _nx( '%s in moderation', '%s in moderation', $num_comm->moderated, 'comments' ), number_format_i18n( $num_comm->moderated ) );
'<li class="comment-mod-count"><a href="edit-comments.php?comment_status=moderated">%1$s %2$s</a></li>', ?>
number_format_i18n( $num_comm->moderated ), <li class="comment-mod-count"><a href="edit-comments.php?comment_status=moderated"><?php echo $text; ?></a></li>
$text <?php
);
} }
} }
do_action( 'rightnow_list_end' ); do_action( 'rightnow_list_end' );
@ -588,17 +584,19 @@ function wp_dashboard_recent_posts( $args ) {
} elseif ( date( 'Y-m-d', $time ) == $tomorrow ) { } elseif ( date( 'Y-m-d', $time ) == $tomorrow ) {
$relative = __( 'Tomorrow' ); $relative = __( 'Tomorrow' );
} else { } else {
$relative = date( 'M jS', $time ); $relative = date_i18n( __( 'M jS' ), $time );
} }
printf( $text = sprintf(
'<li%s><span>%s, %s</span> <a href="%s">%s</a></li>', /* translators: 1: relative date, 2: time, 4: post title */
( $i >= intval ( $args['display'] ) ? ' class="hidden"' : '' ), __( '<span>%1$s, %2$s</span> <a href="%3$s">%4$s</a>' ),
$relative, $relative,
get_the_time(), get_the_time(),
get_edit_post_link(), get_edit_post_link(),
_draft_or_post_title() _draft_or_post_title()
); );
$hidden = $i > $args['display'] ? ' class="hidden"' : '';
$i++; $i++;
} }
@ -966,21 +964,29 @@ function wp_dashboard_quota() {
<div class="mu-storage"> <div class="mu-storage">
<ul> <ul>
<li class="storage-count"> <li class="storage-count">
<?php printf( <?php $text = sprintf(
'<a href="%1$s" title="%3$s">%2$sMB %4$s</a>', /* translators: number of megabytes */
__( '%s MB Space Allowed' ),
number_format_i18n( $quota )
);
printf(
'<a href="%1$s" title="%2$s">%3$s</a>',
esc_url( admin_url( 'upload.php' ) ), esc_url( admin_url( 'upload.php' ) ),
number_format_i18n( $quota ),
__( 'Manage Uploads' ), __( 'Manage Uploads' ),
__( 'Space Allowed' ) $text
); ?> ); ?>
</li><li class="storage-count <?php echo $used_class; ?>"> </li><li class="storage-count <?php echo $used_class; ?>">
<?php printf( <?php $text = sprintf(
'<a href="%1$s" title="%4$s" class="musublink">%2$sMB (%3$s%%) %5$s</a>', /* translators: 1: number of megabytes, 2: percentage */
esc_url( admin_url( 'upload.php' ) ), __( '%1$s MB (%2$s%%) Space Used' ),
number_format_i18n( $used, 2 ), number_format_i18n( $used, 2 ),
$percentused, $percentused
);
printf(
'<a href="%1$s" title="%2$s" class="musublink">%3$s</a>',
esc_url( admin_url( 'upload.php' ) ),
__( 'Manage Uploads' ), __( 'Manage Uploads' ),
__( 'Space Used' ) $text
); ?> ); ?>
</li> </li>
</ul> </ul>