Make WordPress Core


Ignore:
Timestamp:
02/07/2023 05:08:26 PM (17 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/template.php

    r54963 r55276  
    464464
    465465    <div id="replycontainer">
    466     <label for="replycontent" class="screen-reader-text"><?php _e( 'Comment' ); ?></label>
     466    <label for="replycontent" class="screen-reader-text">
     467        <?php
     468        /* translators: Hidden accessibility text. */
     469        _e( 'Comment' );
     470        ?>
     471    </label>
    467472    <?php
    468473    $quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close' );
     
    647652
    648653    $r .= "\n\t<tr id='meta-{$entry['meta_id']}'>";
    649     $r .= "\n\t\t<td class='left'><label class='screen-reader-text' for='meta-{$entry['meta_id']}-key'>" . __( 'Key' ) . "</label><input name='meta[{$entry['meta_id']}][key]' id='meta-{$entry['meta_id']}-key' type='text' size='20' value='{$entry['meta_key']}' />";
     654    $r .= "\n\t\t<td class='left'><label class='screen-reader-text' for='meta-{$entry['meta_id']}-key'>" .
     655        /* translators: Hidden accessibility text. */
     656        __( 'Key' ) .
     657    "</label><input name='meta[{$entry['meta_id']}][key]' id='meta-{$entry['meta_id']}-key' type='text' size='20' value='{$entry['meta_key']}' />";
    650658
    651659    $r .= "\n\t\t<div class='submit'>";
     
    657665    $r .= '</td>';
    658666
    659     $r .= "\n\t\t<td><label class='screen-reader-text' for='meta-{$entry['meta_id']}-value'>" . __( 'Value' ) . "</label><textarea name='meta[{$entry['meta_id']}][value]' id='meta-{$entry['meta_id']}-value' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>\n\t</tr>";
     667    $r .= "\n\t\t<td><label class='screen-reader-text' for='meta-{$entry['meta_id']}-value'>" .
     668        /* translators: Hidden accessibility text. */
     669        __( 'Value' ) .
     670    "</label><textarea name='meta[{$entry['meta_id']}][value]' id='meta-{$entry['meta_id']}-value' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>\n\t</tr>";
    660671    return $r;
    661672}
     
    821832    $cur_mn = current_time( 'i' );
    822833
    823     $month = '<label><span class="screen-reader-text">' . __( 'Month' ) . '</span><select class="form-required" ' . ( $multi ? '' : 'id="mm" ' ) . 'name="mm"' . $tab_index_attribute . ">\n";
     834    $month = '<label><span class="screen-reader-text">' .
     835        /* translators: Hidden accessibility text. */
     836        __( 'Month' ) .
     837    '</span><select class="form-required" ' . ( $multi ? '' : 'id="mm" ' ) . 'name="mm"' . $tab_index_attribute . ">\n";
    824838    for ( $i = 1; $i < 13; $i = $i + 1 ) {
    825839        $monthnum  = zeroise( $i, 2 );
     
    831845    $month .= '</select></label>';
    832846
    833     $day    = '<label><span class="screen-reader-text">' . __( 'Day' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="jj" ' ) . 'name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" class="form-required" /></label>';
    834     $year   = '<label><span class="screen-reader-text">' . __( 'Year' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="aa" ' ) . 'name="aa" value="' . $aa . '" size="4" maxlength="4"' . $tab_index_attribute . ' autocomplete="off" class="form-required" /></label>';
    835     $hour   = '<label><span class="screen-reader-text">' . __( 'Hour' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="hh" ' ) . 'name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" class="form-required" /></label>';
    836     $minute = '<label><span class="screen-reader-text">' . __( 'Minute' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="mn" ' ) . 'name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" class="form-required" /></label>';
     847    $day = '<label><span class="screen-reader-text">' .
     848        /* translators: Hidden accessibility text. */
     849        __( 'Day' ) .
     850    '</span><input type="text" ' . ( $multi ? '' : 'id="jj" ' ) . 'name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" class="form-required" /></label>';
     851    $year = '<label><span class="screen-reader-text">' .
     852        /* translators: Hidden accessibility text. */
     853        __( 'Year' ) .
     854    '</span><input type="text" ' . ( $multi ? '' : 'id="aa" ' ) . 'name="aa" value="' . $aa . '" size="4" maxlength="4"' . $tab_index_attribute . ' autocomplete="off" class="form-required" /></label>';
     855    $hour = '<label><span class="screen-reader-text">' .
     856        /* translators: Hidden accessibility text. */
     857        __( 'Hour' ) .
     858    '</span><input type="text" ' . ( $multi ? '' : 'id="hh" ' ) . 'name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" class="form-required" /></label>';
     859    $minute = '<label><span class="screen-reader-text">' .
     860        /* translators: Hidden accessibility text. */
     861        __( 'Minute' ) .
     862    '</span><input type="text" ' . ( $multi ? '' : 'id="mn" ' ) . 'name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" class="form-required" /></label>';
    837863
    838864    echo '<div class="timestamp-wrap">';
     
    13411367                    if ( 'dashboard_php_nag' === $box['id'] ) {
    13421368                        echo '<span aria-hidden="true" class="dashicons dashicons-warning"></span>';
    1343                         echo '<span class="screen-reader-text">' . __( 'Warning:' ) . ' </span>';
     1369                        echo '<span class="screen-reader-text">' .
     1370                            /* translators: Hidden accessibility text. */
     1371                            __( 'Warning:' ) .
     1372                        ' </span>';
    13441373                    }
    13451374                    echo $box['title'];
     
    13581387
    13591388                        echo '<button type="button" class="handle-order-higher" aria-disabled="false" aria-describedby="' . $box['id'] . '-handle-order-higher-description">';
    1360                         echo '<span class="screen-reader-text">' . __( 'Move up' ) . '</span>';
     1389                        echo '<span class="screen-reader-text">' .
     1390                            /* translators: Hidden accessibility text. */
     1391                            __( 'Move up' ) .
     1392                        '</span>';
    13611393                        echo '<span class="order-higher-indicator" aria-hidden="true"></span>';
    13621394                        echo '</button>';
     
    13681400
    13691401                        echo '<button type="button" class="handle-order-lower" aria-disabled="false" aria-describedby="' . $box['id'] . '-handle-order-lower-description">';
    1370                         echo '<span class="screen-reader-text">' . __( 'Move down' ) . '</span>';
     1402                        echo '<span class="screen-reader-text">' .
     1403                            /* translators: Hidden accessibility text. */
     1404                            __( 'Move down' ) .
     1405                        '</span>';
    13711406                        echo '<span class="order-lower-indicator" aria-hidden="true"></span>';
    13721407                        echo '</button>';
     
    13791414                        echo '<button type="button" class="handlediv" aria-expanded="true">';
    13801415                        echo '<span class="screen-reader-text">' . sprintf(
    1381                             /* translators: %s: Meta box title. */
     1416                            /* translators: %s: Hidden accessibility text. Meta box title. */
    13821417                            __( 'Toggle panel: %s' ),
    13831418                            $widget_title
     
    15311566                        <h3 class="accordion-section-title hndle" tabindex="0">
    15321567                            <?php echo esc_html( $box['title'] ); ?>
    1533                             <span class="screen-reader-text"><?php _e( 'Press return or enter to open this section' ); ?></span>
     1568                            <span class="screen-reader-text">
     1569                                <?php
     1570                                /* translators: Hidden accessibility text. */
     1571                                _e( 'Press return or enter to open this section' );
     1572                                ?>
     1573                            </span>
    15341574                        </h3>
    15351575                        <div class="accordion-section-content <?php postbox_classes( $box['id'], $page ); ?>">
     
    19822022        <div id="find-posts-head" class="find-box-head">
    19832023            <?php _e( 'Attach to existing content' ); ?>
    1984             <button type="button" id="find-posts-close"><span class="screen-reader-text"><?php _e( 'Close media attachment panel' ); ?></span></button>
     2024            <button type="button" id="find-posts-close"><span class="screen-reader-text">
     2025                <?php
     2026                /* translators: Hidden accessibility text. */
     2027                _e( 'Close media attachment panel' );
     2028                ?>
     2029            </span></button>
    19852030        </div>
    19862031        <div class="find-box-inside">
     
    19912036                <input type="hidden" name="affected" id="affected" value="" />
    19922037                <?php wp_nonce_field( 'find-posts', '_ajax_nonce', false ); ?>
    1993                 <label class="screen-reader-text" for="find-posts-input"><?php _e( 'Search' ); ?></label>
     2038                <label class="screen-reader-text" for="find-posts-input">
     2039                    <?php
     2040                    /* translators: Hidden accessibility text. */
     2041                    _e( 'Search' );
     2042                    ?>
     2043                </label>
    19942044                <input type="text" id="find-posts-input" name="ps" value="" />
    19952045                <span class="spinner"></span>
     
    27012751
    27022752    if ( $parsed_args['number'] ) {
    2703         /* translators: 1: The rating, 2: The number of ratings. */
     2753        /* translators: Hidden accessibility text. 1: The rating, 2: The number of ratings. */
    27042754        $format = _n( '%1$s rating based on %2$s rating', '%1$s rating based on %2$s ratings', $parsed_args['number'] );
    27052755        $title  = sprintf( $format, number_format_i18n( $rating, 1 ), number_format_i18n( $parsed_args['number'] ) );
    27062756    } else {
    2707         /* translators: %s: The rating. */
     2757        /* translators: Hidden accessibility text. %s: The rating. */
    27082758        $title = sprintf( __( '%s rating' ), number_format_i18n( $rating, 1 ) );
    27092759    }
Note: See TracChangeset for help on using the changeset viewer.