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/options-reading.php

    r58147 r60805  
    8282        update_option( 'show_on_front', 'posts' );
    8383    }
     84
     85    $your_homepage_displays_title = __( 'Your homepage displays' );
    8486    ?>
    8587<table class="form-table" role="presentation">
    8688<tr>
    87 <th scope="row"><?php _e( 'Your homepage displays' ); ?></th>
     89<th scope="row"><?php echo $your_homepage_displays_title; ?></th>
    8890<td id="front-static-pages"><fieldset>
    89     <legend class="screen-reader-text"><span>
    90         <?php
    91         /* translators: Hidden accessibility text. */
    92         _e( 'Your homepage displays' );
    93         ?>
    94     </span></legend>
     91    <legend class="screen-reader-text"><span><?php echo $your_homepage_displays_title; ?></span></legend>
    9592    <p><label>
    9693        <input name="show_on_front" type="radio" value="posts" class="tog" <?php checked( 'posts', get_option( 'show_on_front' ) ); ?> />
     
    180177<td><input name="posts_per_rss" type="number" step="1" min="1" id="posts_per_rss" value="<?php form_option( 'posts_per_rss' ); ?>" class="small-text" /> <?php _e( 'items' ); ?></td>
    181178</tr>
    182 <tr>
    183 <th scope="row"><?php _e( 'For each post in a feed, include' ); ?> </th>
     179
     180<?php $rss_use_excerpt_title = __( 'For each post in a feed, include' ); ?>
     181<tr>
     182<th scope="row"><?php echo $rss_use_excerpt_title; ?> </th>
    184183<td><fieldset>
    185     <legend class="screen-reader-text"><span>
    186         <?php
    187         /* translators: Hidden accessibility text. */
    188         _e( 'For each post in a feed, include' );
    189         ?>
    190     </span></legend>
     184    <legend class="screen-reader-text"><span><?php echo $rss_use_excerpt_title; ?></span></legend>
    191185    <p>
    192186        <label><input name="rss_use_excerpt" type="radio" value="0" <?php checked( 0, get_option( 'rss_use_excerpt' ) ); ?> /> <?php _e( 'Full text' ); ?></label><br />
     
    205199</tr>
    206200
     201<?php $blog_privacy_selector_title = has_action( 'blog_privacy_selector' ) ? __( 'Site visibility' ) : __( 'Search engine visibility' ); ?>
    207202<tr class="option-site-visibility">
    208 <th scope="row"><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site visibility' ) : _e( 'Search engine visibility' ); ?> </th>
     203<th scope="row"><?php echo $blog_privacy_selector_title; ?> </th>
    209204<td><fieldset>
    210     <legend class="screen-reader-text"><span>
    211         <?php
    212         has_action( 'blog_privacy_selector' )
    213             /* translators: Hidden accessibility text. */
    214             ? _e( 'Site visibility' )
    215             /* translators: Hidden accessibility text. */
    216             : _e( 'Search engine visibility' );
    217         ?>
    218     </span></legend>
     205    <legend class="screen-reader-text"><span><?php echo $blog_privacy_selector_title; ?></span></legend>
    219206<?php if ( has_action( 'blog_privacy_selector' ) ) : ?>
    220207    <input id="blog-public" type="radio" name="blog_public" value="1" <?php checked( '1', get_option( 'blog_public' ) ); ?> />
Note: See TracChangeset for help on using the changeset viewer.