WordPress.org

Make WordPress Core

Changeset 31821


Ignore:
Timestamp:
03/18/2015 09:51:36 PM (6 years ago)
Author:
ocean90
Message:

Comments: Move HTML tags for screen reader text into translatable strings.

Placeholders aren't helpful and it's much easier to make a mistake if you're dealing with placeholders.
Introduced in [31388].

props pento.
fixes #26553.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment-template.php

    r31803 r31821  
    12811281
    12821282    $id = get_the_ID();
    1283     $span = '<span class="screen-reader-text">';
    12841283    $title = get_the_title();
    1285     $span_close = '</span>';
    1286 
    12871284    $number = get_comments_number( $id );
    12881285
    12891286    if ( false === $zero ) {
    1290         /* translators: 1: Opening span tag with a class, 2: post title, 3: closing span tag */
    1291         $zero = sprintf( __( 'No Comments%1$s on %2$s%3$s' ), $span, $title, $span_close );
    1292     }
     1287        /* translators: %s: post title */
     1288        $zero = sprintf( __( 'No Comments<span class="screen-reader-text"> on %s</span>' ), $title );
     1289    }
     1290
    12931291    if ( false === $one ) {
    1294         /* translators: 1: Opening span tag with a class, 2: post title, 3: closing span tag */
    1295         $one = sprintf( __( '1 Comment%1$s on %2$s%3$s' ), $span, $title, $span_close );
    1296     }
     1292        /* translators: %s: post title */
     1293        $one = sprintf( __( '1 Comment<span class="screen-reader-text"> on %s</span>' ), $title );
     1294    }
     1295
    12971296    if ( false === $more ) {
    1298         /* translators: 1: Opening span tag with a class, 2: post title, 3: closing span tag, 4: number of comments */
    1299         $more = sprintf( _n( '%4$s Comment%1$s on %2$s%3$s', '%4$s Comments%1$s on %2$s%3$s', $number ),
    1300             $span, $title, $span_close, number_format_i18n( $number )
    1301         );
    1302     }
     1297        /* translators: 1: Number of comments 2: post title */
     1298        $more = _n( '%1$s Comment<span class="screen-reader-text"> on %2$s</span>', '%1$s Comments<span class="screen-reader-text"> on %2$s</span>', $number );
     1299        $more = sprintf( $more, number_format_i18n( $number ), $title );
     1300    }
     1301
    13031302    if ( false === $none ) {
    1304         /* translators: 1: Opening span tag with a class, 2: post title, 3: closing span tag */
    1305         $none = sprintf( __( 'Comments Off%1$s on %2$s%3$s' ), $span, $title, $span_close );
     1303        /* translators: %s: post title */
     1304        $none = sprintf( __( 'Comments Off<span class="screen-reader-text"> on %s</span>' ), $title );
    13061305    }
    13071306
Note: See TracChangeset for help on using the changeset viewer.