Make WordPress Core

Changeset 26704


Ignore:
Timestamp:
12/05/2013 11:33:48 PM (11 years ago)
Author:
nacin
Message:

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

props SergeyBiryukov, dimadin.
fixes #26066.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/dashboard.php

    r26700 r26704  
    186186    <?php
    187187    do_action( 'rightnow_list_start' );
    188     // Using show_in_nav_menus as my arg for grabbing what post types should show, is there better?
    189     $post_types = get_post_types( array( 'show_in_nav_menus' => true ), 'objects' );
    190     $post_types = (array) apply_filters( 'rightnow_post_types', $post_types );
    191     foreach ( $post_types as $post_type => $post_type_obj ){
     188    // Posts and Pages
     189    foreach ( array( 'post', 'page' ) as $post_type ) {
    192190        $num_posts = wp_count_posts( $post_type );
    193191        if ( $num_posts && $num_posts->publish ) {
    194             printf(
    195                 '<li class="%1$s-count"><a href="edit.php?post_type=%1$s">%2$s %3$s</a></li>',
    196                 $post_type,
    197                 number_format_i18n( $num_posts->publish ),
    198                 $post_type_obj->label
    199             );
     192            if ( 'post' == $post_type ) {
     193                $text = _n( '%s Post', '%s Posts', $num_posts->publish );
     194            } else {
     195                $text = _n( '%s Page', '%s Pages', $num_posts->publish );
     196            }
     197            $text = sprintf( $text, number_format_i18n( $num_posts->publish ) );
     198            printf( '<li class="%1$s-count"><a href="edit.php?post_type=%1$s">%2$s</a></li>', $post_type, $text );
    200199        }
    201200    }
     
    203202    $num_comm = wp_count_comments();
    204203    if ( $num_comm && $num_comm->total_comments ) {
    205         $text = _n( 'comment', 'comments', $num_comm->total_comments );
    206         printf(
    207             '<li class="comment-count"><a href="edit-comments.php">%1$s %2$s</a></li>',
    208             number_format_i18n( $num_comm->total_comments ),
    209             $text
    210         );
     204        $text = sprintf( _n( '%s Comment', '%s Comments', $num_comm->total_comments ), number_format_i18n( $num_comm->total_comments ) );
     205        ?>
     206        <li class="comment-count"><a href="edit-comments.php"><?php echo $text; ?></a></li>
     207        <?php
    211208        if ( $num_comm->moderated ) {
    212             $text = _n( 'in moderation', 'in moderation', $num_comm->total_comments );
    213             printf(
    214                 '<li class="comment-mod-count"><a href="edit-comments.php?comment_status=moderated">%1$s %2$s</a></li>',
    215                 number_format_i18n( $num_comm->moderated ),
    216                 $text
    217             );
     209            /* translators: Number of comments in moderation */
     210            $text = sprintf( _nx( '%s in moderation', '%s in moderation', $num_comm->moderated, 'comments' ), number_format_i18n( $num_comm->moderated ) );
     211            ?>
     212            <li class="comment-mod-count"><a href="edit-comments.php?comment_status=moderated"><?php echo $text; ?></a></li>
     213            <?php
    218214        }
    219215    }
     
    589585                $relative = __( 'Tomorrow' );
    590586            } else {
    591                 $relative = date( 'M jS', $time );
     587                $relative = date_i18n( __( 'M jS' ), $time );
    592588            }
    593589
    594             printf(
    595                 '<li%s><span>%s, %s</span> <a href="%s">%s</a></li>',
    596                 ( $i >= intval ( $args['display'] ) ? ' class="hidden"' : '' ),
    597                 $relative,
    598                 get_the_time(),
    599                 get_edit_post_link(),
    600                 _draft_or_post_title()
    601             );
     590            $text = sprintf(
     591                /* translators: 1: relative date, 2: time, 4: post title */
     592                __( '<span>%1$s, %2$s</span> <a href="%3$s">%4$s</a>' ),
     593                $relative,
     594                get_the_time(),
     595                get_edit_post_link(),
     596                _draft_or_post_title()
     597            );
     598
     599            $hidden = $i > $args['display'] ? ' class="hidden"' : '';
    602600            $i++;
    603601        }
     
    967965    <ul>
    968966        <li class="storage-count">
    969             <?php printf(
    970                 '<a href="%1$s" title="%3$s">%2$sMB %4$s</a>',
     967            <?php $text = sprintf(
     968                /* translators: number of megabytes */
     969                __( '%s MB Space Allowed' ),
     970                number_format_i18n( $quota )
     971            );
     972            printf(
     973                '<a href="%1$s" title="%2$s">%3$s</a>',
    971974                esc_url( admin_url( 'upload.php' ) ),
    972                 number_format_i18n( $quota ),
    973975                __( 'Manage Uploads' ),
    974                 __( 'Space Allowed' )
     976                $text
    975977            ); ?>
    976978        </li><li class="storage-count <?php echo $used_class; ?>">
    977             <?php printf(
    978                 '<a href="%1$s" title="%4$s" class="musublink">%2$sMB (%3$s%%) %5$s</a>',
     979            <?php $text = sprintf(
     980                /* translators: 1: number of megabytes, 2: percentage */
     981                __( '%1$s MB (%2$s%%) Space Used' ),
     982                number_format_i18n( $used, 2 ),
     983                $percentused
     984            );
     985            printf(
     986                '<a href="%1$s" title="%2$s" class="musublink">%3$s</a>',
    979987                esc_url( admin_url( 'upload.php' ) ),
    980                 number_format_i18n( $used, 2 ),
    981                 $percentused,
    982988                __( 'Manage Uploads' ),
    983                 __( 'Space Used' )
     989                $text
    984990            ); ?>
    985991        </li>
Note: See TracChangeset for help on using the changeset viewer.