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/network/settings.php

    r59784 r60805  
    200200        <h2><?php _e( 'Registration Settings' ); ?></h2>
    201201        <table class="form-table" role="presentation">
    202             <tr>
    203                 <th scope="row"><?php _e( 'Allow new registrations' ); ?></th>
     202            <?php $new_registrations_settings_title = __( 'Allow new registrations' ); ?>
     203            <tr>
     204                <th scope="row"><?php echo $new_registrations_settings_title; ?></th>
    204205                <?php
    205206                if ( ! get_site_option( 'registration' ) ) {
     
    210211                <td>
    211212                    <fieldset>
    212                     <legend class="screen-reader-text">
    213                         <?php
    214                         /* translators: Hidden accessibility text. */
    215                         _e( 'New registrations settings' );
    216                         ?>
    217                     </legend>
     213                    <legend class="screen-reader-text"><?php echo $new_registrations_settings_title; ?></legend>
    218214                    <label><input name="registration" type="radio" id="registration1" value="none"<?php checked( $reg, 'none' ); ?> /> <?php _e( 'Registration is disabled' ); ?></label><br />
    219215                    <label><input name="registration" type="radio" id="registration2" value="user"<?php checked( $reg, 'user' ); ?> /> <?php _e( 'User accounts may be registered' ); ?></label><br />
     
    511507            <h2><?php _e( 'Menu Settings' ); ?></h2>
    512508            <table id="menu" class="form-table">
     509                <?php $enable_administration_menus_title = __( 'Enable administration menus' ); ?>
    513510                <tr>
    514                     <th scope="row"><?php _e( 'Enable administration menus' ); ?></th>
     511                    <th scope="row"><?php echo $enable_administration_menus_title; ?></th>
    515512                    <td>
    516513                        <?php
    517                         echo '<fieldset><legend class="screen-reader-text">' .
    518                             /* translators: Hidden accessibility text. */
    519                             __( 'Enable menus' ) .
    520                         '</legend>';
     514                        echo '<fieldset><legend class="screen-reader-text">' . $enable_administration_menus_title . '</legend>';
    521515
    522516                        foreach ( (array) $menu_items as $key => $val ) {
Note: See TracChangeset for help on using the changeset viewer.