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

View File

@ -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'] ),

View File

@ -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,

View File

@ -413,8 +413,16 @@ define('BLOG_ID_CURRENT_SITE', 1);
}
$num_keys_salts = count( $keys_salts );
?>
<p><?php
echo _n( 'This unique authentication key is also missing from your <code>wp-config.php</code> file.', 'These unique authentication keys are also missing from your <code>wp-config.php</code> file.', $num_keys_salts ); ?> <?php _e( 'To make your installation more secure, you should also add:' ) ?></p>
<p>
<?php
if ( 1 == $num_keys_salts ) {
_e( 'This unique authentication key is also missing from your <code>wp-config.php</code> file.' );
} else {
_e( 'These unique authentication keys are also missing from your <code>wp-config.php</code> file.' );
}
?>
<?php _e( 'To make your installation more secure, you should also add:' ); ?>
</p>
<textarea class="code" readonly="readonly" cols="100" rows="<?php echo $num_keys_salts; ?>"><?php echo esc_textarea( $keys_salts_str ); ?></textarea>
<?php
}

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'] ) {

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' );

View File

@ -283,12 +283,20 @@ if ( $action ) {
}
}
$plugins_to_delete = count( $plugin_info );
echo '<h2>' . _n( 'Delete Plugin', 'Delete Plugins', $plugins_to_delete ) . '</h2>';
?>
<?php if ( $have_non_network_plugins && is_network_admin() ) : ?>
<div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php echo _n( 'This plugin may be active on other sites in the network.', 'These plugins may be active on other sites in the network.', $plugins_to_delete ); ?></p></div>
<?php if ( 1 == $plugins_to_delete ) : ?>
<h2><?php _e( 'Delete Plugin' ); ?></h2>
<?php if ( $have_non_network_plugins && is_network_admin() ) : ?>
<div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'This plugin may be active on other sites in the network.' ); ?></p></div>
<?php endif; ?>
<p><?php _e( 'You are about to remove the following plugin:' ); ?></p>
<?php else: ?>
<h2><?php _e( 'Delete Plugins' ); ?></h2>
<?php if ( $have_non_network_plugins && is_network_admin() ) : ?>
<div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'These plugins may be active on other sites in the network.' ); ?></p></div>
<?php endif; ?>
<p><?php _e( 'You are about to remove the following plugins:' ); ?></p>
<?php endif; ?>
<p><?php echo _n( 'You are about to remove the following plugin:', 'You are about to remove the following plugins:', $plugins_to_delete ); ?></p>
<ul class="ul-disc">
<?php
$data_to_delete = false;

View File

@ -219,12 +219,12 @@ if ( ! empty( $_REQUEST['s'] ) )
<?php
$message = '';
if ( ! empty( $_GET['posted'] ) ) {
$message = __('Media attachment updated.');
$message = __( 'Media attachment updated.' );
$_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
}
if ( ! empty( $_GET['attached'] ) && $attached = absint( $_GET['attached'] ) ) {
$message = sprintf( _n('Reattached %d attachment.', 'Reattached %d attachments.', $attached), $attached );
$message = sprintf( _n( 'Reattached %d attachment.', 'Reattached %d attachments.', $attached ), $attached );
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] );
}
@ -234,18 +234,33 @@ if ( ! empty( $_GET['detach'] ) && $detached = absint( $_GET['detach'] ) ) {
}
if ( ! empty( $_GET['deleted'] ) && $deleted = absint( $_GET['deleted'] ) ) {
$message = sprintf( _n( 'Media attachment permanently deleted.', '%d media attachments permanently deleted.', $deleted ), number_format_i18n( $_GET['deleted'] ) );
if ( 1 == $deleted ) {
$message = __( 'Media attachment permanently deleted.' );
} else {
$message = _n( '%d media attachment permanently deleted.', '%d media attachments permanently deleted.', $deleted );
}
$message = sprintf( $message, number_format_i18n( $deleted ) );
$_SERVER['REQUEST_URI'] = remove_query_arg(array('deleted'), $_SERVER['REQUEST_URI']);
}
if ( ! empty( $_GET['trashed'] ) && $trashed = absint( $_GET['trashed'] ) ) {
$message = sprintf( _n( 'Media attachment moved to the trash.', '%d media attachments moved to the trash.', $trashed ), number_format_i18n( $_GET['trashed'] ) );
if ( 1 == $trashed ) {
$message = __( 'Media attachment moved to the trash.' );
} else {
$message = _n( '%d media attachment moved to the trash.', '%d media attachments moved to the trash.', $trashed );
}
$message = sprintf( $message, number_format_i18n( $trashed ) );
$message .= ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media" ) ) . '">' . __('Undo') . '</a>';
$_SERVER['REQUEST_URI'] = remove_query_arg(array('trashed'), $_SERVER['REQUEST_URI']);
}
if ( ! empty( $_GET['untrashed'] ) && $untrashed = absint( $_GET['untrashed'] ) ) {
$message = sprintf( _n( 'Media attachment restored from the trash.', '%d media attachments restored from the trash.', $untrashed ), number_format_i18n( $_GET['untrashed'] ) );
if ( 1 == $untrashed ) {
$message = __( 'Media attachment restored from the trash.' );
} else {
$message = _n( '%d media attachment restored from the trash.', '%d media attachments restored from the trash.', $untrashed );
}
$message = sprintf( $message, number_format_i18n( $untrashed ) );
$_SERVER['REQUEST_URI'] = remove_query_arg(array('untrashed'), $_SERVER['REQUEST_URI']);
}

View File

@ -216,11 +216,17 @@ case 'delete':
<div class="wrap">
<h2><?php _e('Delete Users'); ?></h2>
<?php if ( isset( $_REQUEST['error'] ) ) : ?>
<div class="error">
<p><strong><?php _e( 'ERROR:' ); ?></strong> <?php _e( 'Please select an option.' ); ?></p>
</div>
<div class="error">
<p><strong><?php _e( 'ERROR:' ); ?></strong> <?php _e( 'Please select an option.' ); ?></p>
</div>
<?php endif; ?>
<p><?php echo _n( 'You have specified this user for deletion:', 'You have specified these users for deletion:', count( $userids ) ); ?></p>
<?php if ( 1 == count( $userids ) ) : ?>
<p><?php _e( 'You have specified this user for deletion:' ); ?></p>
<?php else : ?>
<p><?php _e( 'You have specified these users for deletion:' ); ?></p>
<?php endif; ?>
<ul>
<?php
$go_delete = 0;
@ -236,7 +242,11 @@ case 'delete':
?>
</ul>
<?php if ( $go_delete ) : ?>
<fieldset><p><legend><?php echo _n( 'What should be done with content owned by this user?', 'What should be done with content owned by these users?', $go_delete ); ?></legend></p>
<?php if ( 1 == $go_delete ) : ?>
<fieldset><p><legend><?php _e( 'What should be done with content owned by this user?' ); ?></legend></p>
<?php else : ?>
<fieldset><p><legend><?php _e( 'What should be done with content owned by these users?' ); ?></legend></p>
<?php endif; ?>
<ul style="list-style:none;">
<li><label><input type="radio" id="delete_option0" name="delete_option" value="delete" />
<?php _e('Delete all content.'); ?></label></li>
@ -379,7 +389,12 @@ default:
case 'del':
case 'del_many':
$delete_count = isset($_GET['delete_count']) ? (int) $_GET['delete_count'] : 0;
$messages[] = '<div id="message" class="updated"><p>' . sprintf( _n( 'User deleted.', '%s users deleted.', $delete_count ), number_format_i18n( $delete_count ) ) . '</p></div>';
if ( 1 == $delete_count ) {
$message = __( 'User deleted.' );
} else {
$message = _n( '%s user deleted.', '%s users deleted.', $delete_count );
}
$messages[] = '<div id="message" class="updated"><p>' . sprintf( $message, number_format_i18n( $delete_count ) ) . '</p></div>';
break;
case 'add':
if ( isset( $_GET['id'] ) && ( $user_id = $_GET['id'] ) && current_user_can( 'edit_user', $user_id ) ) {

View File

@ -1351,11 +1351,17 @@ final class WP_Customize_Manager {
$menus = wp_get_nav_menus();
$num_locations = count( array_keys( $locations ) );
if ( 1 == $num_locations ) {
$description = __( 'Your theme supports one menu. Select which menu you would like to use.' );
} else {
$description = sprintf( _n( 'Your theme supports %s menu. Select which menu appears in each location.', 'Your theme supports %s menus. Select which menu appears in each location.', $num_locations ), number_format_i18n( $num_locations ) );
}
$this->add_section( 'nav', array(
'title' => __( 'Navigation' ),
'theme_supports' => 'menus',
'priority' => 100,
'description' => sprintf( _n('Your theme supports %s menu. Select which menu you would like to use.', 'Your theme supports %s menus. Select which menu appears in each location.', $num_locations ), number_format_i18n( $num_locations ) ) . "\n\n" . __('You can edit your menu content on the Menus screen in the Appearance section.'),
'description' => $description . "\n\n" . __( 'You can edit your menu content on the Menus screen in the Appearance section.' ),
) );
if ( $menus ) {

View File

@ -23,8 +23,16 @@ _deprecated_file( sprintf( __( 'Theme without %1$s' ), basename(__FILE__) ), '3.
<!-- You can start editing here. -->
<?php if ( have_comments() ) : ?>
<h3 id="comments"><?php printf( _n( 'One Response to %2$s', '%1$s Responses to %2$s', get_comments_number() ),
number_format_i18n( get_comments_number() ), '&#8220;' . get_the_title() . '&#8221;' ); ?></h3>
<h3 id="comments">
<?php
if ( 1 == get_comments_number() ) {
printf( 'One Response to %2$s', '&#8220;' . get_the_title() . '&#8221;' );
} else {
printf( _n( '%1$s Response to %2$s', '%1$s Responses to %2$s', get_comments_number() ),
number_format_i18n( get_comments_number() ), '&#8220;' . get_the_title() . '&#8221;' );
}
?>
</h3>
<div class="navigation">
<div class="alignleft"><?php previous_comments_link() ?></div>

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.2-beta3-31940';
$wp_version = '4.2-beta3-31941';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.