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.
Built from https://develop.svn.wordpress.org/trunk@31941


git-svn-id: http://core.svn.wordpress.org/trunk@31920 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov
2015-03-31 18:45:28 +00:00
parent 563344c643
commit 36643388ef
11 changed files with 136 additions and 45 deletions
+44 -15
View File
@@ -146,14 +146,18 @@ if ( $action ) {
if ( ! isset( $_REQUEST['verify-delete'] ) ) {
wp_enqueue_script( 'jquery' );
require_once( ABSPATH . 'wp-admin/admin-header.php' );
$themes_to_delete = count( $themes );
?>
<div class="wrap">
<?php
$themes_to_delete = count( $themes );
echo '<h2>' . _n( 'Delete Theme', 'Delete Themes', $themes_to_delete ) . '</h2>';
?>
<div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php echo _n( 'This theme may be active on other sites in the network.', 'These themes may be active on other sites in the network.', $themes_to_delete ); ?></p></div>
<p><?php echo _n( 'You are about to remove the following theme:', 'You are about to remove the following themes:', $themes_to_delete ); ?></p>
<?php if ( 1 == $themes_to_delete ) : ?>
<h2><?php _e( 'Delete Theme' ); ?></h2>
<div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'This theme may be active on other sites in the network.' ); ?></p></div>
<p><?php _e( 'You are about to remove the following theme:' ); ?></p>
<?php else : ?>
<h2><?php _e( 'Delete Themes' ); ?></h2>
<div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'These themes may be active on other sites in the network.' ); ?></p></div>
<p><?php _e( 'You are about to remove the following themes:' ); ?></p>
<?php endif; ?>
<ul class="ul-disc">
<?php
foreach ( $theme_info as $theme ) {
@@ -162,7 +166,11 @@ if ( $action ) {
}
?>
</ul>
<p><?php _e('Are you sure you wish to delete these themes?'); ?></p>
<?php if ( 1 == $themes_to_delete ) : ?>
<p><?php _e( 'Are you sure you wish to delete this theme?' ); ?></p>
<?php else : ?>
<p><?php _e( 'Are you sure you wish to delete these themes?' ); ?></p>
<?php endif; ?>
<form method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" style="display:inline;">
<input type="hidden" name="verify-delete" value="1" />
<input type="hidden" name="action" value="delete-selected" />
@@ -170,9 +178,15 @@ if ( $action ) {
foreach ( (array) $themes as $theme ) {
echo '<input type="hidden" name="checked[]" value="' . esc_attr($theme) . '" />';
}
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 );
}
?>
<?php wp_nonce_field('bulk-themes') ?>
<?php submit_button( _n( 'Yes, Delete this theme', 'Yes, Delete these themes', $themes_to_delete ), 'button', 'submit', false ); ?>
</form>
<?php
$referer = wp_get_referer();
@@ -254,14 +268,29 @@ if ( $s )
<?php
if ( isset( $_GET['enabled'] ) ) {
$_GET['enabled'] = absint( $_GET['enabled'] );
echo '<div id="message" class="updated"><p>' . sprintf( _n( 'Theme enabled.', '%s themes enabled.', $_GET['enabled'] ), number_format_i18n( $_GET['enabled'] ) ) . '</p></div>';
$enabled = absint( $_GET['enabled'] );
if ( 1 == $enabled ) {
$message = __( 'Theme enabled.' );
} else {
$message = _n( '%s theme enabled.', '%s themes enabled.', $enabled );
}
echo '<div id="message" class="updated"><p>' . sprintf( $message, number_format_i18n( $enabled ) ) . '</p></div>';
} elseif ( isset( $_GET['disabled'] ) ) {
$_GET['disabled'] = absint( $_GET['disabled'] );
echo '<div id="message" class="updated"><p>' . sprintf( _n( 'Theme disabled.', '%s themes disabled.', $_GET['disabled'] ), number_format_i18n( $_GET['disabled'] ) ) . '</p></div>';
$disabled = absint( $_GET['disabled'] );
if ( 1 == $disabled ) {
$message = __( 'Theme disabled.' );
} else {
$message = _n( '%s theme disabled.', '%s themes disabled.', $disabled );
}
echo '<div id="message" class="updated"><p>' . sprintf( $message, number_format_i18n( $disabled ) ) . '</p></div>';
} elseif ( isset( $_GET['deleted'] ) ) {
$_GET['deleted'] = absint( $_GET['deleted'] );
echo '<div id="message" class="updated"><p>' . sprintf( _nx( 'Theme deleted.', '%s themes deleted.', $_GET['deleted'], 'network' ), number_format_i18n( $_GET['deleted'] ) ) . '</p></div>';
$deleted = absint( $_GET['deleted'] );
if ( 1 == $deleted ) {
$message = __( 'Theme deleted.' );
} else {
$message = _n( '%s theme deleted.', '%s themes deleted.', $deleted );
}
echo '<div id="message" class="updated"><p>' . sprintf( $message, number_format_i18n( $deleted ) ) . '</p></div>';
} elseif ( isset( $_GET['error'] ) && 'none' == $_GET['error'] ) {
echo '<div id="message" class="error"><p>' . __( 'No theme selected.' ) . '</p></div>';
} elseif ( isset( $_GET['error'] ) && 'main' == $_GET['error'] ) {
+6 -6
View File
@@ -24,10 +24,10 @@ function confirm_delete_users( $users ) {
?>
<h2><?php esc_html_e( 'Users' ); ?></h2>
<?php if ( count( $users ) > 1 ) : ?>
<p><?php _e( 'You have chosen to delete the following users from all networks and sites.' ); ?></p>
<?php else : ?>
<?php if ( 1 == count( $users ) ) : ?>
<p><?php _e( 'You have chosen to delete the user from all networks and sites.' ); ?></p>
<?php else : ?>
<p><?php _e( 'You have chosen to delete the following users from all networks and sites.' ); ?></p>
<?php endif; ?>
<form action="users.php?action=dodelete" method="post">
@@ -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 ) : ?>
<p><?php _e( 'Once you hit &#8220;Confirm Deletion&#8221;, these users will be permanently removed.' ); ?></p>
<?php else : ?>
if ( 1 == count( $users ) ) : ?>
<p><?php _e( 'Once you hit &#8220;Confirm Deletion&#8221;, the user will be permanently removed.' ); ?></p>
<?php else : ?>
<p><?php _e( 'Once you hit &#8220;Confirm Deletion&#8221;, these users will be permanently removed.' ); ?></p>
<?php endif;
submit_button( __('Confirm Deletion'), 'delete' );