Index: /trunk/wp-admin/includes/list-table-comments.php
===================================================================
--- /trunk/wp-admin/includes/list-table-comments.php (revision 16072)
+++ /trunk/wp-admin/includes/list-table-comments.php (revision 16073)
@@ -150,5 +150,5 @@
*/
$status_links[$status] = "
" . sprintf(
- _n( $label[0], $label[1], $num_comments->$status ),
+ translate_nooped_plural( $label, $num_comments->$status ),
number_format_i18n( $num_comments->$status )
) . '';
Index: /trunk/wp-admin/includes/list-table-media.php
===================================================================
--- /trunk/wp-admin/includes/list-table-media.php (revision 16072)
+++ /trunk/wp-admin/includes/list-table-media.php (revision 16073)
@@ -68,5 +68,5 @@
$class = ' class="current"';
if ( !empty( $num_posts[$mime_type] ) )
- $type_links[$mime_type] = "" . sprintf( _n( $label[2][0], $label[2][1], $num_posts[$mime_type] ), number_format_i18n( $num_posts[$mime_type] )) . '';
+ $type_links[$mime_type] = "" . sprintf( translate_nooped_plural( $label[2], $num_posts[$mime_type] ), number_format_i18n( $num_posts[$mime_type] )) . '';
}
$type_links['detached'] = '' . sprintf( _nx( 'Unattached (%s)', 'Unattached (%s)', $total_orphans, 'detached files' ), number_format_i18n( $total_orphans ) ) . '';
Index: /trunk/wp-admin/includes/list-table-posts.php
===================================================================
--- /trunk/wp-admin/includes/list-table-posts.php (revision 16072)
+++ /trunk/wp-admin/includes/list-table-posts.php (revision 16073)
@@ -171,5 +171,5 @@
$class = ' class="current"';
- $status_links[$status_name] = "" . sprintf( _n( $status->label_count[0], $status->label_count[1], $num_posts->$status_name ), number_format_i18n( $num_posts->$status_name ) ) . '';
+ $status_links[$status_name] = "" . sprintf( translate_nooped_plural( $status->label_count, $num_posts->$status_name ), number_format_i18n( $num_posts->$status_name ) ) . '';
}
Index: /trunk/wp-admin/includes/media.php
===================================================================
--- /trunk/wp-admin/includes/media.php (revision 16072)
+++ /trunk/wp-admin/includes/media.php (revision 16073)
@@ -1864,5 +1864,5 @@
$class = ' class="current"';
- $type_links[] = "$mime_type, 'paged'=>false))) . "'$class>" . sprintf(_n($label[2][0], $label[2][1], $num_posts[$mime_type]), "" . number_format_i18n( $num_posts[$mime_type] ) . '') . '';
+ $type_links[] = "$mime_type, 'paged'=>false))) . "'$class>" . sprintf( translate_nooped_plural( $label[2], $num_posts[$mime_type] ), "" . number_format_i18n( $num_posts[$mime_type] ) . '') . '';
}
echo implode(' | ', apply_filters( 'media_upload_mime_type_links', $type_links ) ) . '';
Index: /trunk/wp-includes/l10n.php
===================================================================
--- /trunk/wp-includes/l10n.php (revision 16072)
+++ /trunk/wp-includes/l10n.php (revision 16073)
@@ -268,5 +268,5 @@
* ...
* $message = $messages[$type];
- * $usable_text = sprintf(_n($message[0], $message[1], $count), $count);
+ * $usable_text = sprintf( translate_nooped_plural( $message, $count ), $count );
*
* @since 2.5
@@ -275,6 +275,6 @@
* @return array array($single, $plural)
*/
-function _n_noop( $single, $plural ) {
- return array( $single, $plural );
+function _n_noop( $singular, $plural ) {
+ return array( 'singular' => $singular, 'plural' => $plural, 'context' => null );
}
@@ -284,6 +284,21 @@
* @see _n_noop()
*/
-function _nx_noop( $single, $plural, $context ) {
- return array( $single, $plural, $context );
+function _nx_noop( $singular, $plural, $context ) {
+ return array( 'singular' => $singular, 'plural' => $plural, 'context' => $context );
+}
+
+/**
+ * Translate the result of _n_noop() or _nx_noop()
+ *
+ * @since 3.1
+ * @param array $nooped_plural array with singular, plural and context keys, usually the result of _n_noop() or _nx_noop()
+ * @param int $count number of objects
+ * @param string $domain Optional. The domain identifier the text should be retrieved in
+ */
+function translate_nooped_plural( $nooped_plural, $count, $domain = 'default' ) {
+ if ( $nooped_plural['context'] )
+ return _nx( $nooped_plural['singular'], $nooped_plural['plural'], $count, $nooped_plural['context'], $domain );
+ else
+ return _n( $nooped_plural['singular'], $nooped_plural['plural'], $count, $domain );
}