Make WordPress Core


Ignore:
Timestamp:
02/07/2023 05:08:26 PM (22 months ago)
Author:
SergeyBiryukov
Message:

I18N: Mark screen reader strings as such with translator comments.

This aims to provide better context for translators and make it easier to determine that some strings contain hidden accessibility text and are not displayed in the UI.

Props kebbet, mercime, pavelevap, ocean90, swissspidy, Chouby, jipmoors, afercia, desrosj, costdev, audrasjb, SergeyBiryukov.
Fixes #29748.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-list-table.php

    r54378 r55276  
    561561        }
    562562
    563         echo '<label for="bulk-action-selector-' . esc_attr( $which ) . '" class="screen-reader-text">' . __( 'Select bulk action' ) . '</label>';
     563        echo '<label for="bulk-action-selector-' . esc_attr( $which ) . '" class="screen-reader-text">' .
     564            /* translators: Hidden accessibility text. */
     565            __( 'Select bulk action' ) .
     566        '</label>';
    564567        echo '<select name="action' . $two . '" id="bulk-action-selector-' . esc_attr( $which ) . "\">\n";
    565568        echo '<option value="-1">' . __( 'Bulk actions' ) . "</option>\n";
     
    643646        $output .= '</div>';
    644647
    645         $output .= '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>';
     648        $output .= '<button type="button" class="toggle-row"><span class="screen-reader-text">' .
     649            /* translators: Hidden accessibility text. */
     650            __( 'Show more details' ) .
     651        '</span></button>';
    646652
    647653        return $output;
     
    847853                '<span class="post-com-count post-com-count-no-comments"><span class="comment-count comment-count-no-comments" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
    848854                $approved_comments_number,
    849                 $pending_comments ? __( 'No approved comments' ) : __( 'No comments' )
     855                $pending_comments ?
     856                /* translators: Hidden accessibility text. */
     857                __( 'No approved comments' ) :
     858                /* translators: Hidden accessibility text. */
     859                __( 'No comments' )
    850860            );
    851861        }
     
    870880                '<span class="post-com-count post-com-count-pending post-com-count-no-pending"><span class="comment-count comment-count-no-pending" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
    871881                $pending_comments_number,
    872                 $approved_comments ? __( 'No pending comments' ) : __( 'No comments' )
     882                $approved_comments ?
     883                /* translators: Hidden accessibility text. */
     884                __( 'No pending comments' ) :
     885                /* translators: Hidden accessibility text. */
     886                __( 'No comments' )
    873887            );
    874888        }
     
    9951009                "<a class='first-page button' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
    9961010                esc_url( remove_query_arg( 'paged', $current_url ) ),
     1011                /* translators: Hidden accessibility text. */
    9971012                __( 'First page' ),
    9981013                '&laquo;'
     
    10061021                "<a class='prev-page button' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
    10071022                esc_url( add_query_arg( 'paged', max( 1, $current - 1 ), $current_url ) ),
     1023                /* translators: Hidden accessibility text. */
    10081024                __( 'Previous page' ),
    10091025                '&lsaquo;'
     
    10131029        if ( 'bottom' === $which ) {
    10141030            $html_current_page  = $current;
    1015             $total_pages_before = '<span class="screen-reader-text">' . __( 'Current Page' ) . '</span><span id="table-paging" class="paging-input"><span class="tablenav-paging-text">';
     1031            $total_pages_before = '<span class="screen-reader-text">' .
     1032                /* translators: Hidden accessibility text. */
     1033                __( 'Current Page' ) .
     1034            '</span><span id="table-paging" class="paging-input"><span class="tablenav-paging-text">';
    10161035        } else {
    10171036            $html_current_page = sprintf(
    10181037                "%s<input class='current-page' id='current-page-selector' type='text' name='paged' value='%s' size='%d' aria-describedby='table-paging' /><span class='tablenav-paging-text'>",
    1019                 '<label for="current-page-selector" class="screen-reader-text">' . __( 'Current Page' ) . '</label>',
     1038                '<label for="current-page-selector" class="screen-reader-text">' .
     1039                    /* translators: Hidden accessibility text. */
     1040                    __( 'Current Page' ) .
     1041                '</label>',
    10201042                $current,
    10211043                strlen( $total_pages )
     
    10361058                "<a class='next-page button' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
    10371059                esc_url( add_query_arg( 'paged', min( $total_pages, $current + 1 ), $current_url ) ),
     1060                /* translators: Hidden accessibility text. */
    10381061                __( 'Next page' ),
    10391062                '&rsaquo;'
     
    10471070                "<a class='last-page button' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
    10481071                esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
     1072                /* translators: Hidden accessibility text. */
    10491073                __( 'Last page' ),
    10501074                '&raquo;'
     
    12831307        if ( ! empty( $columns['cb'] ) ) {
    12841308            static $cb_counter = 1;
    1285             $columns['cb']     = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All' ) . '</label>'
    1286                 . '<input id="cb-select-all-' . $cb_counter . '" type="checkbox" />';
     1309            $columns['cb']     = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' .
     1310                    /* translators: Hidden accessibility text. */
     1311                    __( 'Select All' ) .
     1312                '</label>' .
     1313                '<input id="cb-select-all-' . $cb_counter . '" type="checkbox" />';
    12871314            $cb_counter++;
    12881315        }
     
    15491576     */
    15501577    protected function handle_row_actions( $item, $column_name, $primary ) {
    1551         return $column_name === $primary ? '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>' : '';
     1578        return $column_name === $primary ? '<button type="button" class="toggle-row"><span class="screen-reader-text">' .
     1579            /* translators: Hidden accessibility text. */
     1580            __( 'Show more details' ) .
     1581        '</span></button>' : '';
    15521582    }
    15531583
Note: See TracChangeset for help on using the changeset viewer.