Make WordPress Core


Ignore:
Timestamp:
09/28/2025 10:36:30 PM (2 months ago)
Author:
joedolson
Message:

I18n: Combine duplicate text strings into variables.

In cases where a string is used both for a visible label and a screen reader text label, the screen reader text should never be different from the visible label. To help ensure this doesn't happen, use only a single string. The associated screen reader text comments are no longer required.

This is also true for a few cases where there are strings in contexts where variables can't be used. In these cases, the screen reader text comments are also removed.

Props sabernhardt, swissspidy, audrasjb, joedolson.
Fixes #63620.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/meta-boxes.php

    r59784 r60805  
    12291229
    12301230    ?>
    1231 <fieldset><legend class="screen-reader-text"><span>
    1232     <?php
    1233     /* translators: Hidden accessibility text. */
    1234     _e( 'Target' );
    1235     ?>
    1236 </span></legend>
     1231<fieldset><legend class="screen-reader-text"><span><?php _e( 'Target' ); ?></span></legend>
    12371232<p><label for="link_target_blank" class="selectit">
    12381233<input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo ( isset( $link->link_target ) && ( '_blank' === $link->link_target ) ? 'checked="checked"' : '' ); ?> />
     
    13221317        <td><input type="text" name="link_rel" id="link_rel" value="<?php echo ( isset( $link->link_rel ) ? esc_attr( $link->link_rel ) : '' ); ?>" /></td>
    13231318    </tr>
     1319    <?php $identity_group_title = /* translators: xfn: https://gmpg.org/xfn/ */ __( 'identity' ); ?>
    13241320    <tr>
    1325         <th scope="row"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'identity' ); ?></th>
     1321        <th scope="row"><?php echo $identity_group_title; ?></th>
    13261322        <td><fieldset>
    1327             <legend class="screen-reader-text"><span>
    1328                 <?php
    1329                 /* translators: Hidden accessibility text. xfn: https://gmpg.org/xfn/ */
    1330                 _e( 'identity' );
    1331                 ?>
    1332             </span></legend>
     1323            <legend class="screen-reader-text"><span><?php echo $identity_group_title; ?></span></legend>
    13331324            <label for="me">
    13341325            <input type="checkbox" name="identity" value="me" id="me" <?php xfn_check( 'identity', 'me' ); ?> />
     
    13361327        </fieldset></td>
    13371328    </tr>
     1329    <?php $friendship_group_title = /* translators: xfn: https://gmpg.org/xfn/ */ __( 'friendship' ); ?>
    13381330    <tr>
    1339         <th scope="row"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'friendship' ); ?></th>
     1331        <th scope="row"><?php echo $friendship_group_title; ?></th>
    13401332        <td><fieldset>
    1341             <legend class="screen-reader-text"><span>
    1342                 <?php
    1343                 /* translators: Hidden accessibility text. xfn: https://gmpg.org/xfn/ */
    1344                 _e( 'friendship' );
    1345                 ?>
    1346             </span></legend>
     1333            <legend class="screen-reader-text"><span><?php echo $friendship_group_title; ?></span></legend>
    13471334            <label for="contact">
    13481335            <input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check( 'friendship', 'contact' ); ?> />&nbsp;<?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'contact' ); ?>
     
    13591346        </fieldset></td>
    13601347    </tr>
     1348    <?php $physical_group_title = /* translators: xfn: https://gmpg.org/xfn/ */ __( 'physical' ); ?>
    13611349    <tr>
    1362         <th scope="row"> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'physical' ); ?> </th>
     1350        <th scope="row"> <?php echo $physical_group_title; ?> </th>
    13631351        <td><fieldset>
    1364             <legend class="screen-reader-text"><span>
    1365                 <?php
    1366                 /* translators: Hidden accessibility text. xfn: https://gmpg.org/xfn/ */
    1367                 _e( 'physical' );
    1368                 ?>
    1369             </span></legend>
     1352            <legend class="screen-reader-text"><span><?php echo $physical_group_title; ?></span></legend>
    13701353            <label for="met">
    13711354            <input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check( 'physical', 'met' ); ?> />&nbsp;<?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'met' ); ?>
     
    13731356        </fieldset></td>
    13741357    </tr>
     1358    <?php $professional_group_title = /* translators: xfn: https://gmpg.org/xfn/ */ __( 'professional' ); ?>
    13751359    <tr>
    1376         <th scope="row"> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'professional' ); ?> </th>
     1360        <th scope="row"> <?php echo $professional_group_title; ?> </th>
    13771361        <td><fieldset>
    1378             <legend class="screen-reader-text"><span>
    1379                 <?php
    1380                 /* translators: Hidden accessibility text. xfn: https://gmpg.org/xfn/ */
    1381                 _e( 'professional' );
    1382                 ?>
    1383             </span></legend>
     1362            <legend class="screen-reader-text"><span><?php echo $professional_group_title; ?></span></legend>
    13841363            <label for="co-worker">
    13851364            <input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check( 'professional', 'co-worker' ); ?> />&nbsp;<?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'co-worker' ); ?>
     
    13901369        </fieldset></td>
    13911370    </tr>
     1371    <?php $geographical_group_title = /* translators: xfn: https://gmpg.org/xfn/ */ __( 'geographical' ); ?>
    13921372    <tr>
    1393         <th scope="row"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'geographical' ); ?></th>
     1373        <th scope="row"><?php echo $geographical_group_title; ?></th>
    13941374        <td><fieldset>
    1395             <legend class="screen-reader-text"><span>
    1396                 <?php
    1397                 /* translators: Hidden accessibility text. xfn: https://gmpg.org/xfn/ */
    1398                 _e( 'geographical' );
    1399                 ?>
    1400             </span></legend>
     1375            <legend class="screen-reader-text"><span><?php echo $geographical_group_title; ?></span></legend>
    14011376            <label for="co-resident">
    14021377            <input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check( 'geographical', 'co-resident' ); ?> />&nbsp;<?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'co-resident' ); ?>
     
    14101385        </fieldset></td>
    14111386    </tr>
     1387    <?php $family_group_title = /* translators: xfn: https://gmpg.org/xfn/ */ __( 'family' ); ?>
    14121388    <tr>
    1413         <th scope="row"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'family' ); ?></th>
     1389        <th scope="row"><?php echo $family_group_title; ?></th>
    14141390        <td><fieldset>
    1415             <legend class="screen-reader-text"><span>
    1416                 <?php
    1417                 /* translators: Hidden accessibility text. xfn: https://gmpg.org/xfn/ */
    1418                 _e( 'family' );
    1419                 ?>
    1420             </span></legend>
     1391            <legend class="screen-reader-text"><span><?php echo $family_group_title; ?></span></legend>
    14211392            <label for="child">
    14221393            <input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check( 'family', 'child' ); ?> />&nbsp;<?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'child' ); ?>
     
    14391410        </fieldset></td>
    14401411    </tr>
     1412    <?php $romantic_group_title = /* translators: xfn: https://gmpg.org/xfn/ */ __( 'romantic' ); ?>
    14411413    <tr>
    1442         <th scope="row"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'romantic' ); ?></th>
     1414        <th scope="row"><?php echo $romantic_group_title; ?></th>
    14431415        <td><fieldset>
    1444             <legend class="screen-reader-text"><span>
    1445                 <?php
    1446                 /* translators: Hidden accessibility text. xfn: https://gmpg.org/xfn/ */
    1447                 _e( 'romantic' );
    1448                 ?>
    1449             </span></legend>
     1416            <legend class="screen-reader-text"><span><?php echo $romantic_group_title; ?></span></legend>
    14501417            <label for="muse">
    14511418            <input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check( 'romantic', 'muse' ); ?> />&nbsp;<?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'muse' ); ?>
Note: See TracChangeset for help on using the changeset viewer.