Make WordPress Core


Ignore:
Timestamp:
12/20/2007 10:36:00 PM (17 years ago)
Author:
ryan
Message:

gettext for new dashboard from nbachiyski. fixes #5499

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/index.php

    r6431 r6441  
    3232
    3333<?php
    34 // I'm not sure how to internationalize this, Nikolay?
    35 
    3634$num_posts = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish'" );
    3735
     
    4846$num_tags = wp_count_terms('post_tag');
    4947
    50 $sentence = 'You have ';
    51 if ( $num_posts )
    52     $sentence .= '<a href="edit.php">' . number_format( $num_posts ) . ' posts</a>, ';
     48$post_type_texts = array();
    5349
    54 if ( $num_pages )
    55     $sentence .= '<a href="edit-pages.php">' . number_format( $num_pages ) . ' pages</a>, ';
     50if ( $num_posts ) {
     51    $post_type_texts[] = '<a href="edit.php">'.sprintf( __ngettext( '%d post', '%d posts', $num_posts ), number_format_i18n( $num_posts ) ).'</a>';
     52}
     53if ( $num_pages ) {
     54    $post_type_texts[] = '<a href="edit-pages.php">'.sprintf( __ngettext( '%d page', '%d pages', $num_pages ), number_format_i18n( $num_pages ) ).'</a>';
     55}
     56if ( $num_drafts ) {
     57    $post_type_texts[] = '<a href="edit.php?post_status=draft">'.sprintf( __ngettext( '%d draft', '%d drafts', $num_drafts ), number_format_i18n( $num_drafts ) ).'</a>';
     58}
     59if ( $num_future ) {
     60    $post_type_texts[] = '<a href="edit.php?post_status=future">'.sprintf( __ngettext( '%d scheduled post', '%d scheduled posts', $num_future ), number_format_i18n( $num_future ) ).'</a>';
     61}
    5662
    57 if ( $num_drafts )
    58     $sentence .= '<a href="edit.php?post_status=draft">' . number_format( $num_drafts ) . ' drafts</a>, ';
     63$cats_text = '<a href="categories.php">'.sprintf( __ngettext( '%d category', '%d categories', $num_cats ), number_format_i18n( $num_cats ) ).'</a>';
     64$tags_text = sprintf( __ngettext( '%d tag', '%d tags', $num_tags ), number_format_i18n( $num_tags ) );
    5965
    60 if ( $num_future )
    61     $sentence .= '<a href="edit.php?post_status=future">' . number_format( $num_future ) . ' scheduled posts</a>, ';
     66$post_type_text = implode(', ', $post_type_texts);
    6267
    6368// There is always a category
    64 $sentence .= 'contained within <a href="categories.php">' . number_format( $num_cats ) . ' categories</a> and ' . number_format( $num_tags ) . ' tags.';
     69$sentence = sprintf( __( 'You have %1$s, contained within %2$s and %3$s.' ), $post_type_text, $cats_text, $tags_text );
    6570
    6671?>
     
    6974$ct = current_theme_info();
    7075$sidebars_widgets = wp_get_sidebars_widgets();
    71 $num_widgets = count( $sidebar_widgets );
     76$num_widgets = array_reduce( $sidebars_widgets, create_function( '$prev, $curr', 'return $prev+count($curr);' ) );
     77$widgets_text = sprintf( __ngettext( '%d widget', '%d widgets', $num_widgets ), $num_widgets );
    7278?>
    73 <p>You use the <?php echo $ct->title; ?> theme with <a href='widgets.php'><?php echo $num_widgets; ?> widgets</a>. <a href="themes.php">Change Theme</a>. You're using BetaPress TODO.</p>
     79<p><?php printf( __( 'You are using %1$s theme with %2$s.' ), $ct->title, $widgets_text ); ?> <a href="themes.php"><?php _e('Change Theme'); ?></a>. You're using BetaPress TODO.</p>
     80<p>
    7481<?php do_action( 'rightnow_end' ); ?>
    7582<?php do_action( 'activity_box_end' ); ?>
     
    7986
    8087<div class="dashboard-widget">
    81 <div class="dashboard-widget-edit"><a href="">See All</a> | <a href="">Edit</a></div>
     88<div class="dashboard-widget-edit"><a href=""><?php _e('See All'); ?></a> | <a href=""><?php _e('Edit'); ?></a></div>
    8289<h3>Recent Comments</h3>
    8390
     
    112119$more_link = apply_filters( 'dashboard_incoming_links_link', 'http://blogsearch.google.com/blogsearch?hl=en&scoring=d&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) );
    113120?>
    114 <div class="dashboard-widget-edit"><a href="<?php echo htmlspecialchars( $more_link ); ?>"><?php _e('See All'); ?></a> | <a href="">Edit</a></div>
    115 <h3>Incoming Links</h3>
     121<div class="dashboard-widget-edit"><a href="<?php echo htmlspecialchars( $more_link ); ?>"><?php _e('See All'); ?></a> | <a href=""><?php _e('Edit'); ?></a></div>
     122<h3><?php _e('Incoming Links'); ?></h3>
    116123
    117124<div id="incominglinks"></div>
     
    122129$recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND " . get_private_posts_cap_sql('post') . " AND post_date_gmt < '$today' ORDER BY post_date DESC LIMIT 5");
    123130?>
    124 <div class="dashboard-widget-edit"><a href="<?php echo htmlspecialchars( $more_link ); ?>"><?php _e('See All'); ?></a> | <a href="">Edit</a></div>
     131<div class="dashboard-widget-edit"><a href="<?php echo htmlspecialchars( $more_link ); ?>"><?php _e('See All'); ?></a> | <a href=""><?php _e('Edit'); ?></a></div>
    125132<h3>Recent Posts</h3>
    126133
     
    139146
    140147<div class="dashboard-widget">
    141 <div class="dashboard-widget-edit"><a href="<?php echo htmlspecialchars( $more_link ); ?>"><?php _e('See All'); ?></a> | <a href="">Edit</a> | <a href="">RSS</a></div>
     148<div class="dashboard-widget-edit"><a href="<?php echo htmlspecialchars( $more_link ); ?>"><?php _e('See All'); ?></a> | <a href=""><?php _e('Edit'); ?></a> | <a href=""><?php _e('RSS'); ?></a></div>
    142149<h3><?php echo apply_filters( 'dashboard_primary_title', __('Blog') ); ?></h3>
    143150
     
    147154<?php do_action( 'dashboard_widgets' ); ?>
    148155
    149 <p><a href="">Customize this page</a>.</p>
     156<p><a href=""><?php _e('Customize this page'); ?></a>.</p>
    150157
    151158</div>
Note: See TracChangeset for help on using the changeset viewer.