WordPress.org

Make WordPress Core

Changeset 7397


Ignore:
Timestamp:
03/19/2008 04:00:09 PM (10 years ago)
Author:
ryan
Message:

ngettext fixes from nbachiyski. fixes #6261

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-comments.php

    r7344 r7397  
    9898$status_links = array();
    9999$num_comments = wp_count_comments();
    100 $stati = array('moderated' => sprintf(__('Awaiting Moderation (%s)'), "<span class='comment-count'>$num_comments->moderated</span>"), 'approved' => __('Approved'));
     100$stati = array('moderated' => sprintf(__ngettext('Awaiting Moderation (%s)', 'Awaiting Moderation (%s)', $num_comments->moderated), "<span class='comment-count'>$num_comments->moderated</span>"), 'approved' => _c('Approved|plural'));
    101101$class = ( '' === $comment_status ) ? ' class="current"' : '';
    102102$status_links[] = "<li><a href=\"edit-comments.php\"$class>".__('Show All Comments')."</a>";
  • trunk/wp-admin/edit-pages.php

    r7307 r7397  
    3737
    3838$post_stati  = array(   //  array( adj, noun )
    39         'publish' => array(__('Published'), __('Published pages'), __('Published (%s)')),
    40         'future' => array(__('Scheduled'), __('Scheduled pages'), __('Scheduled (%s)')),
    41         'pending' => array(__('Pending Review'), __('Pending pages'), __('Pending Review (%s)')),
    42         'draft' => array(__('Draft'), _c('Drafts|manage posts header'), _c('Draft (%s)|manage posts header')),
    43         'private' => array(__('Private'), __('Private pages'), __('Private (%s)'))
     39        'publish' => array(__('Published'), __('Published pages'), __ngettext_noop('Published (%s)', 'Published (%s)')),
     40        'future' => array(__('Scheduled'), __('Scheduled pages'), __ngettext_noop('Scheduled (%s)', 'Scheduled (%s)')),
     41        'pending' => array(__('Pending Review'), __('Pending pages'), __ngettext_noop('Pending Review (%s)', 'Pending Review (%s)')),
     42        'draft' => array(__('Draft'), _c('Drafts|manage posts header'), __ngettext_noop('Draft (%s)', 'Drafts (%s)')),
     43        'private' => array(__('Private'), __('Private pages'), __ngettext_noop('Private (%s)', 'Private (%s)'))
    4444    );
    4545
     
    9494
    9595    $status_links[] = "<li><a href=\"edit-pages.php?post_status=$status\"$class>" .
    96     sprintf($label[2], $num_posts->$status) . '</a>';
     96    sprintf(__ngettext($label[2][0], $label[2][1], $num_posts->$status), $num_posts->$status) . '</a>';
    9797}
    9898echo implode(' |</li>', $status_links) . '</li>';
  • trunk/wp-admin/edit.php

    r7359 r7397  
    9898
    9999    $status_links[] = "<li><a href=\"edit.php?post_status=$status\"$class>" .
    100     sprintf($label[2], $num_posts->$status) . '</a>';
     100    sprintf(__ngettext($label[2][0], $label[2][1], $num_posts->$status), $num_posts->$status) . '</a>';
    101101}
    102102echo implode(' |</li>', $status_links) . '</li>';
  • trunk/wp-admin/import/dotclear.php

    r7072 r7397  
    226226            // Store category translation for future use
    227227            add_option('dccat2wpcat',$dccat2wpcat);
    228             echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> categories imported.'), $count).'<br /><br /></p>';
     228            echo '<p>'.sprintf(__ngettext('Done! <strong>%1$s</strong> category imported.', 'Done! <strong>%1$s</strong> categories imported.', $count), $count).'<br /><br /></p>';
    229229            return true;
    230230        }
  • trunk/wp-admin/import/greymatter.php

    r7072 r7397  
    270270                if ($numAddedComments > 0) {
    271271                    echo ': ';
    272                 printf(__('imported %s'), sprintf( __ngettext('%s comment', '%s comments', $numAddedComments) , $numAddedComments) );
     272                printf( __ngettext('imported %s comment', 'imported %s comments', $numAddedComments) , $numAddedComments);
    273273                }
    274274                $preExisting = $numComments - numAddedComments;
    275275                if ($preExisting > 0) {
    276276                    echo ' ';
    277                     printf(__('ignored %s'), sprintf( __ngettext( '%s pre-existing comment', '%s pre-existing comments', $preExisting ) , $preExisting) );
     277                    printf( __ngettext( 'ignored %s pre-existing comment', 'ignored %s pre-existing comments', $preExisting ) , $preExisting);
    278278                }
    279279            }
  • trunk/wp-admin/import/textpattern.php

    r7072 r7397  
    178178            // Store category translation for future use
    179179            add_option('txpcat2wpcat',$txpcat2wpcat);
    180             echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> categories imported.'), $count).'<br /><br /></p>';
     180            echo '<p>'.sprintf(__ngettext('Done! <strong>%1$s</strong> category imported.', 'Done! <strong>%1$s</strong> categories imported.', $count), $count).'<br /><br /></p>';
    181181            return true;
    182182        }
  • trunk/wp-admin/includes/media.php

    r7396 r7397  
    993993        $class = ' class="current"';
    994994
    995     $type_links[] = "<li><a href='" . add_query_arg(array('post_mime_type'=>$mime_type, 'paged'=>false)) . "'$class>" . sprintf($label[2], "<span id='$mime_type-counter'>{$num_posts[$mime_type]}</span>") . '</a>';
     995    $type_links[] = "<li><a href='" . add_query_arg(array('post_mime_type'=>$mime_type, 'paged'=>false)) . "'$class>" . sprintf(__ngettext($label[2][0], $label[2][1], $num_posts[$mime_type]), "<span id='$mime_type-counter'>{$num_posts[$mime_type]}</span>") . '</a>';
    996996}
    997997echo implode(' | </li>', $type_links) . '</li>';
  • trunk/wp-admin/includes/post.php

    r7352 r7397  
    520520    $q['cat'] = (int) $q['cat'];
    521521    $post_stati  = array(   //  array( adj, noun )
    522                 'publish' => array(__('Published'), __('Published posts'), __('Published (%s)')),
    523                 'future' => array(__('Scheduled'), __('Scheduled posts'), __('Scheduled (%s)')),
    524                 'pending' => array(__('Pending Review'), __('Pending posts'), __('Pending Review (%s)')),
    525                 'draft' => array(__('Draft'), _c('Drafts|manage posts header'), _c('Draft (%s)|manage posts header')),
    526                 'private' => array(__('Private'), __('Private posts'), __('Private (%s)'))
     522                'publish' => array(__('Published'), __('Published posts'), __ngettext_noop('Published (%s)', 'Published (%s)')),
     523                'future' => array(__('Scheduled'), __('Scheduled posts'), __ngettext_noop('Scheduled (%s)', 'Scheduled (%s)')),
     524                'pending' => array(__('Pending Review'), __('Pending posts'), __ngettext_noop('Pending Review (%s)', 'Pending Review (%s)')),
     525                'draft' => array(__('Draft'), _c('Drafts|manage posts header'), __ngettext_noop('Draft (%s)', 'Drafts (%s)')),
     526                'private' => array(__('Private'), __('Private posts'), __ngettext_noop('Private (%s)', 'Private (%s)')),
    527527            );
    528528
     
    569569    $q['post_status'] = 'any';
    570570    $post_mime_types = array(   //  array( adj, noun )
    571                 'image' => array(__('Images'), __('Manage Images'), __('Images (%s)')),
    572                 'audio' => array(__('Audio'), __('Manage Audio'), __('Audio (%s)')),
    573                 'video' => array(__('Video'), __('Manage Video'), __('Video (%s)')),
     571                'image' => array(__('Images'), __('Manage Images'), __ngettext_noop('Image (%s)', 'Images (%s)')),
     572                'audio' => array(__('Audio'), __('Manage Audio'), __ngettext_noop('Audio (%s)', 'Audio (%s)')),
     573                'video' => array(__('Video'), __('Manage Video'), __ngettext_noop('Video (%s)', 'Video (%s)')),
    574574            );
    575575    $post_mime_types = apply_filters('post_mime_types', $post_mime_types);
  • trunk/wp-admin/upload.php

    r7359 r7397  
    9999
    100100    $type_links[] = "<li><a href=\"upload.php?post_mime_type=$mime_type\"$class>" .
    101     sprintf($label[2], $num_posts[$mime_type]) . '</a>';
     101    sprintf(__ngettext($label[2][0], $label[2][1], $num_posts[$mime_type]), $num_posts[$mime_type]) . '</a>';
    102102}
    103103echo implode(' | </li>', $type_links) . '</li>';
  • trunk/wp-includes/l10n.php

    r6916 r7397  
    197197
    198198/**
     199 * __ngettext_noop() - register plural strings in POT file, but don't translate them
     200 *
     201 * Used when you want do keep structures with translatable plural strings and
     202 * use them later.
     203 *
     204 * Example:
     205 *  $messages = array(
     206 *      'post' => ngettext_noop('%s post', '%s posts'),
     207 *      'page' => ngettext_noop('%s pages', '%s pages')
     208 *  );
     209 *  ...
     210 *  $message = $messages[$type];
     211 *  $usable_text = sprintf(__ngettext($message[0], $message[1], $count), $count);
     212 *
     213 * @since 2.5
     214 * @param $single Single form to be i18ned
     215 * @param $plural Plural form to be i18ned
     216 * @param $number Not used, here for compatibility with __ngettext, optional
     217 * @param $domain Not used, here for compatibility with __ngettext, optional
     218 * @return array array($single, $plural)
     219 */
     220function __ngettext_noop($single, $plural, $number=1, $domain = 'default') {
     221    return array($single, $plural);
     222}
     223
     224/**
    199225 * load_textdomain() - Loads MO file into the list of domains
    200226 *
Note: See TracChangeset for help on using the changeset viewer.