WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/31/2015 06:44:46 PM (7 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/upload.php

    r31696 r31941  
    220220$message = '';
    221221if ( ! empty( $_GET['posted'] ) ) {
    222     $message = __('Media attachment updated.');
     222    $message = __( 'Media attachment updated.' );
    223223    $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
    224224}
    225225
    226226if ( ! empty( $_GET['attached'] ) && $attached = absint( $_GET['attached'] ) ) {
    227     $message = sprintf( _n('Reattached %d attachment.', 'Reattached %d attachments.', $attached), $attached );
     227    $message = sprintf( _n( 'Reattached %d attachment.', 'Reattached %d attachments.', $attached ), $attached );
    228228    $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] );
    229229}
     
    235235
    236236if ( ! empty( $_GET['deleted'] ) && $deleted = absint( $_GET['deleted'] ) ) {
    237     $message = sprintf( _n( 'Media attachment permanently deleted.', '%d media attachments permanently deleted.', $deleted ), number_format_i18n( $_GET['deleted'] ) );
     237    if ( 1 == $deleted ) {
     238        $message = __( 'Media attachment permanently deleted.' );
     239    } else {
     240        $message = _n( '%d media attachment permanently deleted.', '%d media attachments permanently deleted.', $deleted );
     241    }
     242    $message = sprintf( $message, number_format_i18n( $deleted ) );
    238243    $_SERVER['REQUEST_URI'] = remove_query_arg(array('deleted'), $_SERVER['REQUEST_URI']);
    239244}
    240245
    241246if ( ! empty( $_GET['trashed'] ) && $trashed = absint( $_GET['trashed'] ) ) {
    242     $message = sprintf( _n( 'Media attachment moved to the trash.', '%d media attachments moved to the trash.', $trashed ), number_format_i18n( $_GET['trashed'] ) );
     247    if ( 1 == $trashed ) {
     248        $message = __( 'Media attachment moved to the trash.' );
     249    } else {
     250        $message = _n( '%d media attachment moved to the trash.', '%d media attachments moved to the trash.', $trashed );
     251    }
     252    $message = sprintf( $message, number_format_i18n( $trashed ) );
    243253    $message .= ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media" ) ) . '">' . __('Undo') . '</a>';
    244254    $_SERVER['REQUEST_URI'] = remove_query_arg(array('trashed'), $_SERVER['REQUEST_URI']);
     
    246256
    247257if ( ! empty( $_GET['untrashed'] ) && $untrashed = absint( $_GET['untrashed'] ) ) {
    248     $message = sprintf( _n( 'Media attachment restored from the trash.', '%d media attachments restored from the trash.', $untrashed ), number_format_i18n( $_GET['untrashed'] ) );
     258    if ( 1 == $untrashed ) {
     259        $message = __( 'Media attachment restored from the trash.' );
     260    } else {
     261        $message = _n( '%d media attachment restored from the trash.', '%d media attachments restored from the trash.', $untrashed );
     262    }
     263    $message = sprintf( $message, number_format_i18n( $untrashed ) );
    249264    $_SERVER['REQUEST_URI'] = remove_query_arg(array('untrashed'), $_SERVER['REQUEST_URI']);
    250265}
Note: See TracChangeset for help on using the changeset viewer.