Make WordPress Core


Ignore:
Timestamp:
03/31/2015 06:44:46 PM (9 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/network/themes.php

    r31696 r31941  
    147147                wp_enqueue_script( 'jquery' );
    148148                require_once( ABSPATH . 'wp-admin/admin-header.php' );
     149                $themes_to_delete = count( $themes );
    149150                ?>
    150151            <div class="wrap">
    151                 <?php
    152                     $themes_to_delete = count( $themes );
    153                     echo '<h2>' . _n( 'Delete Theme', 'Delete Themes', $themes_to_delete ) . '</h2>';
    154                 ?>
    155                 <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>
    156                 <p><?php echo _n( 'You are about to remove the following theme:', 'You are about to remove the following themes:', $themes_to_delete ); ?></p>
     152                <?php if ( 1 == $themes_to_delete ) : ?>
     153                    <h2><?php _e( 'Delete Theme' ); ?></h2>
     154                    <div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'This theme may be active on other sites in the network.' ); ?></p></div>
     155                    <p><?php _e( 'You are about to remove the following theme:' ); ?></p>
     156                <?php else : ?>
     157                    <h2><?php _e( 'Delete Themes' ); ?></h2>
     158                    <div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'These themes may be active on other sites in the network.' ); ?></p></div>
     159                    <p><?php _e( 'You are about to remove the following themes:' ); ?></p>
     160                <?php endif; ?>
    157161                    <ul class="ul-disc">
    158162                    <?php
     
    163167                    ?>
    164168                    </ul>
    165                 <p><?php _e('Are you sure you wish to delete these themes?'); ?></p>
     169                <?php if ( 1 == $themes_to_delete ) : ?>
     170                    <p><?php _e( 'Are you sure you wish to delete this theme?' ); ?></p>
     171                <?php else : ?>
     172                    <p><?php _e( 'Are you sure you wish to delete these themes?' ); ?></p>
     173                <?php endif; ?>
    166174                <form method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" style="display:inline;">
    167175                    <input type="hidden" name="verify-delete" value="1" />
     
    171179                            echo '<input type="hidden" name="checked[]" value="' . esc_attr($theme) . '" />';
    172180                        }
     181
     182                        wp_nonce_field( 'bulk-themes' );
     183
     184                        if ( 1 == $themes_to_delete ) {
     185                            submit_button( __( 'Yes, Delete this theme' ), 'button', 'submit', false );
     186                        } else {
     187                            submit_button( __( 'Yes, Delete these themes' ), 'button', 'submit', false );
     188                        }
    173189                    ?>
    174                     <?php wp_nonce_field('bulk-themes') ?>
    175                     <?php submit_button( _n( 'Yes, Delete this theme', 'Yes, Delete these themes', $themes_to_delete ), 'button', 'submit', false ); ?>
    176190                </form>
    177191                <?php
     
    255269<?php
    256270if ( isset( $_GET['enabled'] ) ) {
    257     $_GET['enabled'] = absint( $_GET['enabled'] );
    258     echo '<div id="message" class="updated"><p>' . sprintf( _n( 'Theme enabled.', '%s themes enabled.', $_GET['enabled'] ), number_format_i18n( $_GET['enabled'] ) ) . '</p></div>';
     271    $enabled = absint( $_GET['enabled'] );
     272    if ( 1 == $enabled ) {
     273        $message = __( 'Theme enabled.' );
     274    } else {
     275        $message = _n( '%s theme enabled.', '%s themes enabled.', $enabled );
     276    }
     277    echo '<div id="message" class="updated"><p>' . sprintf( $message, number_format_i18n( $enabled ) ) . '</p></div>';
    259278} elseif ( isset( $_GET['disabled'] ) ) {
    260     $_GET['disabled'] = absint( $_GET['disabled'] );
    261     echo '<div id="message" class="updated"><p>' . sprintf( _n( 'Theme disabled.', '%s themes disabled.', $_GET['disabled'] ), number_format_i18n( $_GET['disabled'] ) ) . '</p></div>';
     279    $disabled = absint( $_GET['disabled'] );
     280    if ( 1 == $disabled ) {
     281        $message = __( 'Theme disabled.' );
     282    } else {
     283        $message = _n( '%s theme disabled.', '%s themes disabled.', $disabled );
     284    }
     285    echo '<div id="message" class="updated"><p>' . sprintf( $message, number_format_i18n( $disabled ) ) . '</p></div>';
    262286} elseif ( isset( $_GET['deleted'] ) ) {
    263     $_GET['deleted'] = absint( $_GET['deleted'] );
    264     echo '<div id="message" class="updated"><p>' . sprintf( _nx( 'Theme deleted.', '%s themes deleted.', $_GET['deleted'], 'network' ), number_format_i18n( $_GET['deleted'] ) ) . '</p></div>';
     287    $deleted = absint( $_GET['deleted'] );
     288    if ( 1 == $deleted ) {
     289        $message = __( 'Theme deleted.' );
     290    } else {
     291        $message = _n( '%s theme deleted.', '%s themes deleted.', $deleted );
     292    }
     293    echo '<div id="message" class="updated"><p>' . sprintf( $message, number_format_i18n( $deleted ) ) . '</p></div>';
    265294} elseif ( isset( $_GET['error'] ) && 'none' == $_GET['error'] ) {
    266295    echo '<div id="message" class="error"><p>' . __( 'No theme selected.' ) . '</p></div>';
Note: See TracChangeset for help on using the changeset viewer.