Make WordPress Core


Ignore:
Timestamp:
04/06/2023 04:42:40 PM (4 years ago)
Author:
SergeyBiryukov
Message:

I18N: Correct translator comments placement in wp-admin/edit-comments.php.

This ensures that the translator comments are displayed for the strings they refer to, e.g. to explain placeholders in comment action messages, and are not displayed for unrelated strings, e.g. "Undo", to avoid confusion.

Includes minor code layout fixes and wrapping a few long lines for better readability.

Follow-up to [35549], [45926], [45932].

Props afercia.
See #57839.

File:
1 edited

Legend:

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

    r55412 r55630  
    443443
    444444        if ( 'trashed' === $message && isset( $_REQUEST['ids'] ) ) {
    445                 $ids        = preg_replace( '/[^0-9,]/', '', $_REQUEST['ids'] );
    446                 $messages[] = '<a href="' . esc_url( wp_nonce_url( "edit.php?post_type=$post_type&doaction=undo&action=untrash&ids=$ids", 'bulk-posts' ) ) . '">' . __( 'Undo' ) . '</a>';
     445                $ids = preg_replace( '/[^0-9,]/', '', $_REQUEST['ids'] );
     446
     447                $messages[] = sprintf(
     448                        '<a href="%1$s">%2$s</a>',
     449                        esc_url( wp_nonce_url( "edit.php?post_type=$post_type&doaction=undo&action=untrash&ids=$ids", 'bulk-posts' ) ),
     450                        __( 'Undo' )
     451                );
    447452        }
    448453
    … …  
    461466
    462467if ( $messages ) {
    463         echo '<div id="message" class="updated notice is-dismissible"><p>' . implode( ' ', $messages ) . '</p></div>';
     468        printf(
     469                '<div id="message" class="updated notice is-dismissible"><p>%s</p></div>',
     470                implode( ' ', $messages )
     471        );
    464472}
    465473unset( $messages );
Note: See TracChangeset for help on using the changeset viewer.