From 0d55562fd72dbcc54f3113ee3c611f36df27e920 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 31 Mar 2015 18:44:46 +0000 Subject: [PATCH] Decouple strings where the singular and plural form are not just the same string with different numbers, but essentially two different strings. This allows for using proper plural forms in languages with more than two forms, and also resolves string conflicts when the same string is present in both singular and plural form. fixes #28502. git-svn-id: https://develop.svn.wordpress.org/trunk@31941 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/edit.php | 6 +- src/wp-admin/includes/ajax-actions.php | 2 +- src/wp-admin/network.php | 12 +++- src/wp-admin/network/themes.php | 59 ++++++++++++++----- src/wp-admin/network/users.php | 12 ++-- src/wp-admin/plugins.php | 16 +++-- src/wp-admin/upload.php | 25 ++++++-- src/wp-admin/users.php | 27 +++++++-- .../class-wp-customize-manager.php | 8 ++- src/wp-includes/theme-compat/comments.php | 12 +++- 10 files changed, 135 insertions(+), 44 deletions(-) diff --git a/src/wp-admin/edit.php b/src/wp-admin/edit.php index 10b4e46831..447da1e33c 100644 --- a/src/wp-admin/edit.php +++ b/src/wp-admin/edit.php @@ -247,14 +247,16 @@ $bulk_counts = array( $bulk_messages = array(); $bulk_messages['post'] = array( 'updated' => _n( '%s post updated.', '%s posts updated.', $bulk_counts['updated'] ), - 'locked' => _n( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $bulk_counts['locked'] ), + 'locked' => ( 1 == $bulk_counts['locked'] ) ? __( '1 post not updated, somebody is editing it.' ) : + _n( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $bulk_counts['locked'] ), 'deleted' => _n( '%s post permanently deleted.', '%s posts permanently deleted.', $bulk_counts['deleted'] ), 'trashed' => _n( '%s post moved to the Trash.', '%s posts moved to the Trash.', $bulk_counts['trashed'] ), 'untrashed' => _n( '%s post restored from the Trash.', '%s posts restored from the Trash.', $bulk_counts['untrashed'] ), ); $bulk_messages['page'] = array( 'updated' => _n( '%s page updated.', '%s pages updated.', $bulk_counts['updated'] ), - 'locked' => _n( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $bulk_counts['locked'] ), + 'locked' => ( 1 == $bulk_counts['locked'] ) ? __( '1 page not updated, somebody is editing it.' ) : + _n( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $bulk_counts['locked'] ), 'deleted' => _n( '%s page permanently deleted.', '%s pages permanently deleted.', $bulk_counts['deleted'] ), 'trashed' => _n( '%s page moved to the Trash.', '%s pages moved to the Trash.', $bulk_counts['trashed'] ), 'untrashed' => _n( '%s page restored from the Trash.', '%s pages restored from the Trash.', $bulk_counts['untrashed'] ), diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php index b272d570d6..c3f86de67e 100644 --- a/src/wp-admin/includes/ajax-actions.php +++ b/src/wp-admin/includes/ajax-actions.php @@ -379,7 +379,7 @@ function _wp_ajax_delete_comment_response( $comment_id, $delta = -1 ) { // Here for completeness - not used. 'id' => $comment_id, 'supplemental' => array( - 'total_items_i18n' => sprintf( _n( '1 item', '%s items', $total ), number_format_i18n( $total ) ), + 'total_items_i18n' => sprintf( _n( '%s item', '%s items', $total ), number_format_i18n( $total ) ), 'total_pages' => ceil( $total / $per_page ), 'total_pages_i18n' => number_format_i18n( ceil( $total / $per_page ) ), 'total' => $total, diff --git a/src/wp-admin/network.php b/src/wp-admin/network.php index 66ec0f6370..53cfe450eb 100644 --- a/src/wp-admin/network.php +++ b/src/wp-admin/network.php @@ -413,8 +413,16 @@ define('BLOG_ID_CURRENT_SITE', 1); } $num_keys_salts = count( $keys_salts ); ?> -

wp-config.php file.', 'These unique authentication keys are also missing from your wp-config.php file.', $num_keys_salts ); ?>

+

+ wp-config.php file.' ); + } else { + _e( 'These unique authentication keys are also missing from your wp-config.php file.' ); + } + ?> + +

- ' . _n( 'Delete Theme', 'Delete Themes', $themes_to_delete ) . ''; - ?> -

-

+ +

+

+

+ +

+

+

+ -

+ +

+ +

+
@@ -170,9 +178,15 @@ if ( $action ) { foreach ( (array) $themes as $theme ) { echo ''; } + + wp_nonce_field( 'bulk-themes' ); + + if ( 1 == $themes_to_delete ) { + submit_button( __( 'Yes, Delete this theme' ), 'button', 'submit', false ); + } else { + submit_button( __( 'Yes, Delete these themes' ), 'button', 'submit', false ); + } ?> - -

' . sprintf( _n( 'Theme enabled.', '%s themes enabled.', $_GET['enabled'] ), number_format_i18n( $_GET['enabled'] ) ) . '

'; + $enabled = absint( $_GET['enabled'] ); + if ( 1 == $enabled ) { + $message = __( 'Theme enabled.' ); + } else { + $message = _n( '%s theme enabled.', '%s themes enabled.', $enabled ); + } + echo '

' . sprintf( $message, number_format_i18n( $enabled ) ) . '

'; } elseif ( isset( $_GET['disabled'] ) ) { - $_GET['disabled'] = absint( $_GET['disabled'] ); - echo '

' . sprintf( _n( 'Theme disabled.', '%s themes disabled.', $_GET['disabled'] ), number_format_i18n( $_GET['disabled'] ) ) . '

'; + $disabled = absint( $_GET['disabled'] ); + if ( 1 == $disabled ) { + $message = __( 'Theme disabled.' ); + } else { + $message = _n( '%s theme disabled.', '%s themes disabled.', $disabled ); + } + echo '

' . sprintf( $message, number_format_i18n( $disabled ) ) . '

'; } elseif ( isset( $_GET['deleted'] ) ) { - $_GET['deleted'] = absint( $_GET['deleted'] ); - echo '

' . sprintf( _nx( 'Theme deleted.', '%s themes deleted.', $_GET['deleted'], 'network' ), number_format_i18n( $_GET['deleted'] ) ) . '

'; + $deleted = absint( $_GET['deleted'] ); + if ( 1 == $deleted ) { + $message = __( 'Theme deleted.' ); + } else { + $message = _n( '%s theme deleted.', '%s themes deleted.', $deleted ); + } + echo '

' . sprintf( $message, number_format_i18n( $deleted ) ) . '

'; } elseif ( isset( $_GET['error'] ) && 'none' == $_GET['error'] ) { echo '

' . __( 'No theme selected.' ) . '

'; } elseif ( isset( $_GET['error'] ) && 'main' == $_GET['error'] ) { diff --git a/src/wp-admin/network/users.php b/src/wp-admin/network/users.php index 3bb9854ef4..23871f6e79 100644 --- a/src/wp-admin/network/users.php +++ b/src/wp-admin/network/users.php @@ -24,10 +24,10 @@ function confirm_delete_users( $users ) { ?>

- 1 ) : ?> -

- +

+ +

@@ -103,10 +103,10 @@ function confirm_delete_users( $users ) { /** This action is documented in wp-admin/users.php */ do_action( 'delete_user_form', $current_user ); - if ( count( $users ) > 1 ) : ?> -

- + if ( 1 == count( $users ) ) : ?>

+ +

' . _n( 'Delete Plugin', 'Delete Plugins', $plugins_to_delete ) . ''; ?> - -

+ +

+ +

+ +

+ +

+ +

+ +

-