WordPress.org

Make WordPress Core

Ticket #6261: late-plurals.diff

File late-plurals.diff, 10.1 KB (added by nbachiyski, 10 years ago)
  • wp-includes/l10n.php

     
    196196}
    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 *
    201227 * If the domain already exists, the inclusion will fail. If the
     
    296322        load_textdomain($domain, $mofile);
    297323}
    298324
    299 ?>
    300  No newline at end of file
     325?>
  • wp-admin/edit-comments.php

     
    9797<?php
    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>";
    103103foreach ( $stati as $status => $label ) {
  • wp-admin/includes/media.php

     
    983983        if ( wp_match_mime_types($mime_type, $_GET['post_mime_type']) )
    984984                $class = ' class="current"';
    985985
    986         $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>';
     986        $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>';
    987987}
    988988echo implode(' | </li>', $type_links) . '</li>';
    989989unset($type_links);
  • wp-admin/includes/post.php

     
    519519        $q['m']   = (int) $q['m'];
    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
    529529        $post_stati = apply_filters('post_stati', $post_stati);
     
    568568        $q['post_type'] = 'attachment';
    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);
    576576
  • wp-admin/upload.php

     
    9898                $class = ' class="current"';
    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>';
    104104unset($type_links);
  • wp-admin/import/dotclear.php

     
    225225
    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                }
    231231                echo __('No Categories to Import!');
  • wp-admin/import/textpattern.php

     
    177177
    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                }
    183183                echo __('No Categories to Import!');
  • wp-admin/import/greymatter.php

     
    269269                                }
    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                        }
    280280                        echo '... <strong>'.__('Done').'</strong></li>';
  • wp-admin/edit.php

     
    9797                $class = ' class="current"';
    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>';
    103103unset($status_links);
  • wp-admin/edit-pages.php

     
    3636wp_enqueue_script('admin-forms');
    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
    4646$post_status_label = __('Manage Pages');
     
    9393                $class = ' class="current"';
    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>';
    9999unset($status_links);