Skip to content

Use variables for translatable strings in hidden legends, to match visible text #9396

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 17 additions & 35 deletions src/wp-admin/includes/class-custom-background.php
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,8 @@ public function admin_page() {
<input name="background-preset" type="hidden" value="custom">

<?php
$background_position_title = __( 'Image Position' );

$background_position = sprintf(
'%s %s',
get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ),
Expand Down Expand Up @@ -429,13 +431,8 @@ public function admin_page() {
);
?>
<tr>
<th scope="row"><?php _e( 'Image Position' ); ?></th>
<td><fieldset><legend class="screen-reader-text"><span>
<?php
/* translators: Hidden accessibility text. */
_e( 'Image Position' );
?>
</span></legend>
<th scope="row"><?php echo $background_position_title; ?></th>
<td><fieldset><legend class="screen-reader-text"><span><?php echo $background_position_title; ?></span></legend>
<div class="background-position-control">
<?php foreach ( $background_position_options as $group ) : ?>
<div class="button-group">
Expand All @@ -452,14 +449,10 @@ public function admin_page() {
</fieldset></td>
</tr>

<?php $image_size_title = __( 'Image Size' ); ?>
<tr>
<th scope="row"><label for="background-size"><?php _e( 'Image Size' ); ?></label></th>
<td><fieldset><legend class="screen-reader-text"><span>
<?php
/* translators: Hidden accessibility text. */
_e( 'Image Size' );
?>
</span></legend>
<th scope="row"><label for="background-size"><?php echo $image_size_title; ?></label></th>
<td><fieldset><legend class="screen-reader-text"><span><?php echo $image_size_title; ?></span></legend>
<select id="background-size" name="background-size">
<option value="auto"<?php selected( 'auto', get_theme_mod( 'background_size', get_theme_support( 'custom-background', 'default-size' ) ) ); ?>><?php _ex( 'Original', 'Original Size' ); ?></option>
<option value="contain"<?php selected( 'contain', get_theme_mod( 'background_size', get_theme_support( 'custom-background', 'default-size' ) ) ); ?>><?php _e( 'Fit to Screen' ); ?></option>
Expand All @@ -468,40 +461,29 @@ public function admin_page() {
</fieldset></td>
</tr>

<?php $background_repeat_title = _x( 'Repeat', 'Background Repeat' ); ?>
<tr>
<th scope="row"><?php _ex( 'Repeat', 'Background Repeat' ); ?></th>
<td><fieldset><legend class="screen-reader-text"><span>
<?php
/* translators: Hidden accessibility text. */
_ex( 'Repeat', 'Background Repeat' );
?>
</span></legend>
<th scope="row"><?php echo $background_repeat_title; ?></th>
<td><fieldset><legend class="screen-reader-text"><span><?php echo $background_repeat_title; ?></span></legend>
<input name="background-repeat" type="hidden" value="no-repeat">
<label><input type="checkbox" name="background-repeat" value="repeat"<?php checked( 'repeat', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) ); ?>> <?php _e( 'Repeat Background Image' ); ?></label>
</fieldset></td>
</tr>

<?php $background_scroll_title = _x( 'Scroll', 'Background Scroll' ); ?>
<tr>
<th scope="row"><?php _ex( 'Scroll', 'Background Scroll' ); ?></th>
<td><fieldset><legend class="screen-reader-text"><span>
<?php
/* translators: Hidden accessibility text. */
_ex( 'Scroll', 'Background Scroll' );
?>
</span></legend>
<th scope="row"><?php echo $background_scroll_title; ?></th>
<td><fieldset><legend class="screen-reader-text"><span><?php echo $background_scroll_title; ?></span></legend>
<input name="background-attachment" type="hidden" value="fixed">
<label><input name="background-attachment" type="checkbox" value="scroll" <?php checked( 'scroll', get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) ) ); ?>> <?php _e( 'Scroll with Page' ); ?></label>
</fieldset></td>
</tr>
<?php endif; // get_background_image() ?>

<?php $background_color_title = __( 'Background Color' ); ?>
<tr>
<th scope="row"><?php _e( 'Background Color' ); ?></th>
<td><fieldset><legend class="screen-reader-text"><span>
<?php
/* translators: Hidden accessibility text. */
_e( 'Background Color' );
?>
</span></legend>
<th scope="row"><?php echo $background_color_title; ?></th>
<td><fieldset><legend class="screen-reader-text"><span><?php echo $background_color_title; ?></span></legend>
<?php
$default_color = '';
if ( current_theme_supports( 'custom-background', 'default-color' ) ) {
Expand Down
77 changes: 22 additions & 55 deletions src/wp-admin/includes/meta-boxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -1228,12 +1228,7 @@ function link_categories_meta_box( $link ) {
function link_target_meta_box( $link ) {

?>
<fieldset><legend class="screen-reader-text"><span>
<?php
/* translators: Hidden accessibility text. */
_e( 'Target' );
?>
</span></legend>
<fieldset><legend class="screen-reader-text"><span><?php _e( 'Target' ); ?></span></legend>
<p><label for="link_target_blank" class="selectit">
<input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo ( isset( $link->link_target ) && ( '_blank' === $link->link_target ) ? 'checked="checked"' : '' ); ?> />
<?php _e( '<code>_blank</code> &mdash; new window or tab.' ); ?></label></p>
Expand Down Expand Up @@ -1321,29 +1316,21 @@ function link_xfn_meta_box( $link ) {
<th scope="row"><label for="link_rel"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'rel:' ); ?></label></th>
<td><input type="text" name="link_rel" id="link_rel" value="<?php echo ( isset( $link->link_rel ) ? esc_attr( $link->link_rel ) : '' ); ?>" /></td>
</tr>
<?php $identity_group_title = /* translators: xfn: https://gmpg.org/xfn/ */ __( 'identity' ); ?>
<tr>
<th scope="row"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'identity' ); ?></th>
<th scope="row"><?php echo $identity_group_title; ?></th>
<td><fieldset>
<legend class="screen-reader-text"><span>
<?php
/* translators: Hidden accessibility text. xfn: https://gmpg.org/xfn/ */
_e( 'identity' );
?>
</span></legend>
<legend class="screen-reader-text"><span><?php echo $identity_group_title; ?></span></legend>
<label for="me">
<input type="checkbox" name="identity" value="me" id="me" <?php xfn_check( 'identity', 'me' ); ?> />
<?php _e( 'another web address of mine' ); ?></label>
</fieldset></td>
</tr>
<?php $friendship_group_title = /* translators: xfn: https://gmpg.org/xfn/ */ __( 'friendship' ); ?>
<tr>
<th scope="row"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'friendship' ); ?></th>
<th scope="row"><?php echo $friendship_group_title; ?></th>
<td><fieldset>
<legend class="screen-reader-text"><span>
<?php
/* translators: Hidden accessibility text. xfn: https://gmpg.org/xfn/ */
_e( 'friendship' );
?>
</span></legend>
<legend class="screen-reader-text"><span><?php echo $friendship_group_title; ?></span></legend>
<label for="contact">
<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' ); ?>
</label>
Expand All @@ -1358,29 +1345,21 @@ function link_xfn_meta_box( $link ) {
</label>
</fieldset></td>
</tr>
<?php $physical_group_title = /* translators: xfn: https://gmpg.org/xfn/ */ __( 'physical' ); ?>
<tr>
<th scope="row"> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'physical' ); ?> </th>
<th scope="row"> <?php echo $physical_group_title; ?> </th>
<td><fieldset>
<legend class="screen-reader-text"><span>
<?php
/* translators: Hidden accessibility text. xfn: https://gmpg.org/xfn/ */
_e( 'physical' );
?>
</span></legend>
<legend class="screen-reader-text"><span><?php echo $physical_group_title; ?></span></legend>
<label for="met">
<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' ); ?>
</label>
</fieldset></td>
</tr>
<?php $professional_group_title = /* translators: xfn: https://gmpg.org/xfn/ */ __( 'professional' ); ?>
<tr>
<th scope="row"> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'professional' ); ?> </th>
<th scope="row"> <?php echo $professional_group_title; ?> </th>
<td><fieldset>
<legend class="screen-reader-text"><span>
<?php
/* translators: Hidden accessibility text. xfn: https://gmpg.org/xfn/ */
_e( 'professional' );
?>
</span></legend>
<legend class="screen-reader-text"><span><?php echo $professional_group_title; ?></span></legend>
<label for="co-worker">
<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' ); ?>
</label>
Expand All @@ -1389,15 +1368,11 @@ function link_xfn_meta_box( $link ) {
</label>
</fieldset></td>
</tr>
<?php $geographical_group_title = /* translators: xfn: https://gmpg.org/xfn/ */ __( 'geographical' ); ?>
<tr>
<th scope="row"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'geographical' ); ?></th>
<th scope="row"><?php echo $geographical_group_title; ?></th>
<td><fieldset>
<legend class="screen-reader-text"><span>
<?php
/* translators: Hidden accessibility text. xfn: https://gmpg.org/xfn/ */
_e( 'geographical' );
?>
</span></legend>
<legend class="screen-reader-text"><span><?php echo $geographical_group_title; ?></span></legend>
<label for="co-resident">
<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' ); ?>
</label>
Expand All @@ -1409,15 +1384,11 @@ function link_xfn_meta_box( $link ) {
</label>
</fieldset></td>
</tr>
<?php $family_group_title = /* translators: xfn: https://gmpg.org/xfn/ */ __( 'family' ); ?>
<tr>
<th scope="row"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'family' ); ?></th>
<th scope="row"><?php echo $family_group_title; ?></th>
<td><fieldset>
<legend class="screen-reader-text"><span>
<?php
/* translators: Hidden accessibility text. xfn: https://gmpg.org/xfn/ */
_e( 'family' );
?>
</span></legend>
<legend class="screen-reader-text"><span><?php echo $family_group_title; ?></span></legend>
<label for="child">
<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' ); ?>
</label>
Expand All @@ -1438,15 +1409,11 @@ function link_xfn_meta_box( $link ) {
</label>
</fieldset></td>
</tr>
<?php $romantic_group_title = /* translators: xfn: https://gmpg.org/xfn/ */ __( 'romantic' ); ?>
<tr>
<th scope="row"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'romantic' ); ?></th>
<th scope="row"><?php echo $romantic_group_title; ?></th>
<td><fieldset>
<legend class="screen-reader-text"><span>
<?php
/* translators: Hidden accessibility text. xfn: https://gmpg.org/xfn/ */
_e( 'romantic' );
?>
</span></legend>
<legend class="screen-reader-text"><span><?php echo $romantic_group_title; ?></span></legend>
<label for="muse">
<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' ); ?>
</label>
Expand Down
7 changes: 1 addition & 6 deletions src/wp-admin/includes/misc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1022,12 +1022,7 @@ function admin_color_scheme_picker( $user_id ) {
}
?>
<fieldset id="color-picker" class="scheme-list">
<legend class="screen-reader-text"><span>
<?php
/* translators: Hidden accessibility text. */
_e( 'Administration Color Scheme' );
?>
</span></legend>
<legend class="screen-reader-text"><span><?php _e( 'Administration Color Scheme' ); ?></span></legend>
<?php
wp_nonce_field( 'save-color-scheme', 'color-nonce', false );
foreach ( $_wp_admin_css_colors as $color => $color_info ) :
Expand Down
13 changes: 3 additions & 10 deletions src/wp-admin/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,19 +180,12 @@ function display_setup_form( $error = null ) {
<td><input name="admin_email" type="email" id="admin_email" size="25" aria-describedby="admin-email-desc" value="<?php echo esc_attr( $admin_email ); ?>" />
<p id="admin-email-desc"><?php _e( 'Double-check your email address before continuing.' ); ?></p></td>
</tr>
<?php $blog_privacy_selector_title = has_action( 'blog_privacy_selector' ) ? __( 'Site visibility' ) : __( 'Search engine visibility' ); ?>
<tr>
<th scope="row"><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site visibility' ) : _e( 'Search engine visibility' ); ?></th>
<th scope="row"><?php echo $blog_privacy_selector_title; ?></th>
<td>
<fieldset>
<legend class="screen-reader-text"><span>
<?php
has_action( 'blog_privacy_selector' )
/* translators: Hidden accessibility text. */
? _e( 'Site visibility' )
/* translators: Hidden accessibility text. */
: _e( 'Search engine visibility' );
?>
</span></legend>
<legend class="screen-reader-text"><span><?php echo $blog_privacy_selector_title; ?></span></legend>
<?php
if ( has_action( 'blog_privacy_selector' ) ) {
?>
Expand Down
18 changes: 6 additions & 12 deletions src/wp-admin/network/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,9 @@
</table>
<h2><?php _e( 'Registration Settings' ); ?></h2>
<table class="form-table" role="presentation">
<?php $new_registrations_settings_title = __( 'Allow new registrations' ); ?>
<tr>
<th scope="row"><?php _e( 'Allow new registrations' ); ?></th>
<th scope="row"><?php echo $new_registrations_settings_title; ?></th>
<?php
if ( ! get_site_option( 'registration' ) ) {
update_site_option( 'registration', 'none' );
Expand All @@ -209,12 +210,7 @@
?>
<td>
<fieldset>
<legend class="screen-reader-text">
<?php
/* translators: Hidden accessibility text. */
_e( 'New registrations settings' );
?>
</legend>
<legend class="screen-reader-text"><?php echo $new_registrations_settings_title; ?></legend>
<label><input name="registration" type="radio" id="registration1" value="none"<?php checked( $reg, 'none' ); ?> /> <?php _e( 'Registration is disabled' ); ?></label><br />
<label><input name="registration" type="radio" id="registration2" value="user"<?php checked( $reg, 'user' ); ?> /> <?php _e( 'User accounts may be registered' ); ?></label><br />
<label><input name="registration" type="radio" id="registration3" value="blog"<?php checked( $reg, 'blog' ); ?> /> <?php _e( 'Logged in users may register new sites' ); ?></label><br />
Expand Down Expand Up @@ -510,14 +506,12 @@
?>
<h2><?php _e( 'Menu Settings' ); ?></h2>
<table id="menu" class="form-table">
<?php $enable_administration_menus_title = __( 'Enable administration menus' ); ?>
<tr>
<th scope="row"><?php _e( 'Enable administration menus' ); ?></th>
<th scope="row"><?php echo $enable_administration_menus_title; ?></th>
<td>
<?php
echo '<fieldset><legend class="screen-reader-text">' .
/* translators: Hidden accessibility text. */
__( 'Enable menus' ) .
'</legend>';
echo '<fieldset><legend class="screen-reader-text">' . $enable_administration_menus_title . '</legend>';

foreach ( (array) $menu_items as $key => $val ) {
echo "<label><input type='checkbox' name='menu_items[" . $key . "]' value='1'" . ( isset( $menu_perms[ $key ] ) ? checked( $menu_perms[ $key ], '1', false ) : '' ) . ' /> ' . esc_html( $val ) . '</label><br/>';
Expand Down
11 changes: 4 additions & 7 deletions src/wp-admin/network/site-info.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@
<td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo esc_attr( $details->last_updated ); ?>" /></td>
</tr>
<?php
$site_attributes_title = __( 'Attributes' );

$attribute_fields = array( 'public' => _x( 'Public', 'site' ) );
if ( ! $is_main_site ) {
$attribute_fields['archived'] = __( 'Archived' );
Expand All @@ -205,15 +207,10 @@
$attribute_fields['mature'] = __( 'Mature' );
?>
<tr>
<th scope="row"><?php _e( 'Attributes' ); ?></th>
<th scope="row"><?php echo $site_attributes_title; ?></th>
<td>
<fieldset>
<legend class="screen-reader-text">
<?php
/* translators: Hidden accessibility text. */
_e( 'Set site attributes' );
?>
</legend>
<legend class="screen-reader-text"><?php echo $site_attributes_title; ?></legend>
<?php foreach ( $attribute_fields as $field_key => $field_label ) : ?>
<label><input type="checkbox" name="blog[<?php echo $field_key; ?>]" value="1" <?php checked( (bool) $details->$field_key, true ); ?> <?php disabled( ! in_array( (int) $details->$field_key, array( 0, 1 ), true ) ); ?> />
<?php echo $field_label; ?></label><br />
Expand Down
Loading
Loading