diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php index 0b4061607..3969c123e 100644 --- a/wp-admin/edit-comments.php +++ b/wp-admin/edit-comments.php @@ -97,7 +97,7 @@ if ( isset( $_GET['approved'] ) || isset( $_GET['deleted'] ) || isset( $_GET['sp sprintf(__('Awaiting Moderation (%s)'), "$num_comments->moderated"), 'approved' => __('Approved')); +$stati = array('moderated' => sprintf(__ngettext('Awaiting Moderation (%s)', 'Awaiting Moderation (%s)', $num_comments->moderated), "$num_comments->moderated"), 'approved' => _c('Approved|plural')); $class = ( '' === $comment_status ) ? ' class="current"' : ''; $status_links[] = "
  • ".__('Show All Comments').""; foreach ( $stati as $status => $label ) { diff --git a/wp-admin/edit-pages.php b/wp-admin/edit-pages.php index 7fef3bbb1..dd0732203 100644 --- a/wp-admin/edit-pages.php +++ b/wp-admin/edit-pages.php @@ -36,11 +36,11 @@ $parent_file = 'edit.php'; wp_enqueue_script('admin-forms'); $post_stati = array( // array( adj, noun ) - 'publish' => array(__('Published'), __('Published pages'), __('Published (%s)')), - 'future' => array(__('Scheduled'), __('Scheduled pages'), __('Scheduled (%s)')), - 'pending' => array(__('Pending Review'), __('Pending pages'), __('Pending Review (%s)')), - 'draft' => array(__('Draft'), _c('Drafts|manage posts header'), _c('Draft (%s)|manage posts header')), - 'private' => array(__('Private'), __('Private pages'), __('Private (%s)')) + 'publish' => array(__('Published'), __('Published pages'), __ngettext_noop('Published (%s)', 'Published (%s)')), + 'future' => array(__('Scheduled'), __('Scheduled pages'), __ngettext_noop('Scheduled (%s)', 'Scheduled (%s)')), + 'pending' => array(__('Pending Review'), __('Pending pages'), __ngettext_noop('Pending Review (%s)', 'Pending Review (%s)')), + 'draft' => array(__('Draft'), _c('Drafts|manage posts header'), __ngettext_noop('Draft (%s)', 'Drafts (%s)')), + 'private' => array(__('Private'), __('Private pages'), __ngettext_noop('Private (%s)', 'Private (%s)')) ); $post_status_label = __('Manage Pages'); @@ -93,7 +93,7 @@ foreach ( $post_stati as $status => $label ) { $class = ' class="current"'; $status_links[] = "
  • " . - sprintf($label[2], $num_posts->$status) . ''; + sprintf(__ngettext($label[2][0], $label[2][1], $num_posts->$status), $num_posts->$status) . ''; } echo implode(' |
  • ', $status_links) . ''; unset($status_links); diff --git a/wp-admin/edit.php b/wp-admin/edit.php index 24e231af6..967c9da43 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -97,7 +97,7 @@ foreach ( $post_stati as $status => $label ) { $class = ' class="current"'; $status_links[] = "
  • " . - sprintf($label[2], $num_posts->$status) . ''; + sprintf(__ngettext($label[2][0], $label[2][1], $num_posts->$status), $num_posts->$status) . ''; } echo implode(' |
  • ', $status_links) . ''; unset($status_links); diff --git a/wp-admin/import/dotclear.php b/wp-admin/import/dotclear.php index 953d1b4fa..16df934ff 100644 --- a/wp-admin/import/dotclear.php +++ b/wp-admin/import/dotclear.php @@ -225,7 +225,7 @@ class Dotclear_Import { // Store category translation for future use add_option('dccat2wpcat',$dccat2wpcat); - echo '

    '.sprintf(__('Done! %1$s categories imported.'), $count).'

    '; + echo '

    '.sprintf(__ngettext('Done! %1$s category imported.', 'Done! %1$s categories imported.', $count), $count).'

    '; return true; } echo __('No Categories to Import!'); diff --git a/wp-admin/import/greymatter.php b/wp-admin/import/greymatter.php index 6159b0f38..92abc48bd 100644 --- a/wp-admin/import/greymatter.php +++ b/wp-admin/import/greymatter.php @@ -269,12 +269,12 @@ class GM_Import { } if ($numAddedComments > 0) { echo ': '; - printf(__('imported %s'), sprintf( __ngettext('%s comment', '%s comments', $numAddedComments) , $numAddedComments) ); + printf( __ngettext('imported %s comment', 'imported %s comments', $numAddedComments) , $numAddedComments); } $preExisting = $numComments - numAddedComments; if ($preExisting > 0) { echo ' '; - printf(__('ignored %s'), sprintf( __ngettext( '%s pre-existing comment', '%s pre-existing comments', $preExisting ) , $preExisting) ); + printf( __ngettext( 'ignored %s pre-existing comment', 'ignored %s pre-existing comments', $preExisting ) , $preExisting); } } echo '... '.__('Done').''; diff --git a/wp-admin/import/textpattern.php b/wp-admin/import/textpattern.php index f2d7f8703..1c10015f0 100644 --- a/wp-admin/import/textpattern.php +++ b/wp-admin/import/textpattern.php @@ -177,7 +177,7 @@ class Textpattern_Import { // Store category translation for future use add_option('txpcat2wpcat',$txpcat2wpcat); - echo '

    '.sprintf(__('Done! %1$s categories imported.'), $count).'

    '; + echo '

    '.sprintf(__ngettext('Done! %1$s category imported.', 'Done! %1$s categories imported.', $count), $count).'

    '; return true; } echo __('No Categories to Import!'); diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index d37c483b9..82cdd0aaa 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -992,7 +992,7 @@ foreach ( $post_mime_types as $mime_type => $label ) { if ( wp_match_mime_types($mime_type, $_GET['post_mime_type']) ) $class = ' class="current"'; - $type_links[] = "
  • $mime_type, 'paged'=>false)) . "'$class>" . sprintf($label[2], "{$num_posts[$mime_type]}") . ''; + $type_links[] = "
  • $mime_type, 'paged'=>false)) . "'$class>" . sprintf(__ngettext($label[2][0], $label[2][1], $num_posts[$mime_type]), "{$num_posts[$mime_type]}") . ''; } echo implode(' |
  • ', $type_links) . ''; unset($type_links); diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index 590923892..41cf3548a 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -519,11 +519,11 @@ function wp_edit_posts_query( $q = false ) { $q['m'] = (int) $q['m']; $q['cat'] = (int) $q['cat']; $post_stati = array( // array( adj, noun ) - 'publish' => array(__('Published'), __('Published posts'), __('Published (%s)')), - 'future' => array(__('Scheduled'), __('Scheduled posts'), __('Scheduled (%s)')), - 'pending' => array(__('Pending Review'), __('Pending posts'), __('Pending Review (%s)')), - 'draft' => array(__('Draft'), _c('Drafts|manage posts header'), _c('Draft (%s)|manage posts header')), - 'private' => array(__('Private'), __('Private posts'), __('Private (%s)')) + 'publish' => array(__('Published'), __('Published posts'), __ngettext_noop('Published (%s)', 'Published (%s)')), + 'future' => array(__('Scheduled'), __('Scheduled posts'), __ngettext_noop('Scheduled (%s)', 'Scheduled (%s)')), + 'pending' => array(__('Pending Review'), __('Pending posts'), __ngettext_noop('Pending Review (%s)', 'Pending Review (%s)')), + 'draft' => array(__('Draft'), _c('Drafts|manage posts header'), __ngettext_noop('Draft (%s)', 'Drafts (%s)')), + 'private' => array(__('Private'), __('Private posts'), __ngettext_noop('Private (%s)', 'Private (%s)')), ); $post_stati = apply_filters('post_stati', $post_stati); @@ -568,9 +568,9 @@ function wp_edit_attachments_query( $q = false ) { $q['post_type'] = 'attachment'; $q['post_status'] = 'any'; $post_mime_types = array( // array( adj, noun ) - 'image' => array(__('Images'), __('Manage Images'), __('Images (%s)')), - 'audio' => array(__('Audio'), __('Manage Audio'), __('Audio (%s)')), - 'video' => array(__('Video'), __('Manage Video'), __('Video (%s)')), + 'image' => array(__('Images'), __('Manage Images'), __ngettext_noop('Image (%s)', 'Images (%s)')), + 'audio' => array(__('Audio'), __('Manage Audio'), __ngettext_noop('Audio (%s)', 'Audio (%s)')), + 'video' => array(__('Video'), __('Manage Video'), __ngettext_noop('Video (%s)', 'Video (%s)')), ); $post_mime_types = apply_filters('post_mime_types', $post_mime_types); diff --git a/wp-admin/upload.php b/wp-admin/upload.php index 89a3404b1..1815bb928 100644 --- a/wp-admin/upload.php +++ b/wp-admin/upload.php @@ -98,7 +98,7 @@ foreach ( $post_mime_types as $mime_type => $label ) { $class = ' class="current"'; $type_links[] = "
  • " . - sprintf($label[2], $num_posts[$mime_type]) . ''; + sprintf(__ngettext($label[2][0], $label[2][1], $num_posts[$mime_type]), $num_posts[$mime_type]) . ''; } echo implode(' |
  • ', $type_links) . ''; unset($type_links); diff --git a/wp-includes/l10n.php b/wp-includes/l10n.php index 2d43dbbb3..0584f9daa 100644 --- a/wp-includes/l10n.php +++ b/wp-includes/l10n.php @@ -195,6 +195,32 @@ function __ngettext($single, $plural, $number, $domain = 'default') { } } +/** + * __ngettext_noop() - register plural strings in POT file, but don't translate them + * + * Used when you want do keep structures with translatable plural strings and + * use them later. + * + * Example: + * $messages = array( + * 'post' => ngettext_noop('%s post', '%s posts'), + * 'page' => ngettext_noop('%s pages', '%s pages') + * ); + * ... + * $message = $messages[$type]; + * $usable_text = sprintf(__ngettext($message[0], $message[1], $count), $count); + * + * @since 2.5 + * @param $single Single form to be i18ned + * @param $plural Plural form to be i18ned + * @param $number Not used, here for compatibility with __ngettext, optional + * @param $domain Not used, here for compatibility with __ngettext, optional + * @return array array($single, $plural) + */ +function __ngettext_noop($single, $plural, $number=1, $domain = 'default') { + return array($single, $plural); +} + /** * load_textdomain() - Loads MO file into the list of domains * @@ -296,4 +322,4 @@ function load_theme_textdomain($domain) { load_textdomain($domain, $mofile); } -?> \ No newline at end of file +?>