Making WordPress.org

Changeset 4066


Ignore:
Timestamp:
09/14/2016 07:38:37 PM (9 years ago)
Author:
coffee2code
Message:

Support Forums: Improve i18n in Ratings_Compat.

Props SergeyBiryukov.
Fixes #2035.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-ratings-compat.php

    r4061 r4066  
    140140                $ratings_count = isset( $this->ratings_counts[ $rating ] ) ? $this->ratings_counts[ $rating ] : 0;
    141141                $ratings_count_total = isset( $this->ratings_counts ) ? array_sum( $this->ratings_counts) : 0;
    142                 $stars_title = sprintf( _n( 'Click to see reviews that provided a rating of %d star', 'Click to see reviews that provided a rating of %d stars', $rating, 'wporg-forums' ), $rating );
     142                $stars_title = sprintf(
     143                    /* translators: %s: number of stars */
     144                    _n( 'Click to see reviews that provided a rating of %d star',
     145                        'Click to see reviews that provided a rating of %d stars',
     146                        $rating,
     147                        'wporg-forums' ),
     148                    $rating
     149                );
     150                /* translators: %d: number of stars */
    143151                $stars_text = sprintf( __( '%d stars', 'wporg-forums' ), $rating );
    144152                $width = 0;
     
    163171    <div class="col-5">
    164172        <div style="font-weight:bold;"><?php _e( 'Average Rating', 'wporg-forums' ); ?></div>
    165         <?php echo \WPORG_Ratings::get_dashicons_stars( $this->avg_rating ); ?><?php echo sprintf( __( '%s out of <span itemprop="bestRating">5</span> stars', 'wporg-forums' ), round( isset( $this->avg_rating ) ? $this->avg_rating : 0, 1 ) ); ?>
     173        <?php
     174            echo \WPORG_Ratings::get_dashicons_stars( $this->avg_rating );
     175            /* translators: %s: number of stars */
     176            printf( __( '%s out of <span itemprop="bestRating">5</span> stars', 'wporg-forums' ),
     177                round( isset( $this->avg_rating ) ? $this->avg_rating : 0, 1 )
     178            );
     179        ?>
    166180        <div class="reviews-submit-link">
    167181        <?php
     
    173187                echo '<span class="reviews-need-login">';
    174188                printf(
    175                     /* translators: %s: translation of verb string "log in or register" */
    176                     __( 'You must %s to submit a review.', 'wporg-forums' ),
    177                     sprintf(
    178                         '<a href="https://login.wordpress.org/?redirect_to=%s">%s</a>',
     189                    /* translators: %s: login URL */
     190                    __( 'You must <a href="%s">log in or register</a> to submit a review.', 'wporg-forums' ),
     191                    add_query_arg(
     192                        'redirect_to',
    179193                        urlencode( esc_url_raw( sprintf( 'https://wordpress.org/support/%s/%s/reviews/', $this->compat, $this->slug ) ) ),
    180                         esc_html_x( 'log in or register', 'verb: You must log in or register to submit a review.', 'wporg-forums' )
     194                        'https://login.wordpress.org/'
    181195                    )
    182196                );
     
    193207        echo '<div class="col-9 reviews-filtered-msg" style="font-style:italic;margin-top:24px;">';
    194208        printf(
    195             _n( 'You are currently viewing the reviews that provided a rating of <strong>%d star</strong>. <a href="%s">Click here</a> to see all reviews.',
    196                 'You are currently viewing the reviews that provided a rating of <strong>%d stars</strong>. <a href="%s">Click here</a> to see all reviews.',
    197                 'wporg-forums' ), $filter, esc_url ( sprintf( '//wordpress.org/support/%s/%s/reviews/', $this->compat, $this->slug ) ) );
     209            /* translators: %d: number of stars */
     210            _n( 'You are currently viewing the reviews that provided a rating of <strong>%d star</strong>.',
     211                'You are currently viewing the reviews that provided a rating of <strong>%d stars</strong>.',
     212                $filter,
     213                'wporg-forums' ),
     214            $filter
     215        );
     216        printf(
     217            /* translators: %s: plugin/theme reviews URL */
     218            __( '<a href="%s">Click here</a> to see all reviews.', 'wporg-forums' ),
     219            esc_url( sprintf( '//wordpress.org/support/%s/%s/reviews/', $this->compat, $this->slug ) )
     220        );
    198221        echo "</div>\n";
    199222    }
     
    229252            echo '<p>';
    230253            printf(
    231                 /* translators: %s: translation of verb string "log in or register" */
    232                 __( 'You must %s to submit a review.', 'wporg-forums' ),
    233                 sprintf(
    234                     '<a href="https://login.wordpress.org/?redirect_to=%s">%s</a>',
     254                /* translators: %s: login URL */
     255                __( 'You must <a href="%s">log in or register</a> to submit a review.', 'wporg-forums' ),
     256                add_query_arg(
     257                    'redirect_to',
    235258                    urlencode( esc_url_raw( sprintf( 'https://wordpress.org/support/%s/%s/reviews/', $this->compat, $this->slug ) ) ),
    236                     esc_html_x( 'log in or register', 'verb: You must log in or register to submit a review.', 'wporg-forums' )
     259                    'https://login.wordpress.org/'
    237260                )
    238261            );
     
    268291        switch( $this->compat ) {
    269292            case 'plugin' :
    270                 $report = __( 'If you are reporting an issue with this plugin, please post %s instead.', 'wporg-forums' );
     293                /* translators: %s: plugin support forum URL */
     294                $report = __( 'If you are reporting an issue with this plugin, please post <a href="%s">here</a> instead.', 'wporg-forums' );
    271295                $rate   = __( 'In order to rate a plugin, you must also submit a review.', 'wporg-forums' );
    272296                break;
    273297            case 'theme' :
    274                 $report = __( 'If you are reporting an issue with this theme, please post %s instead.', 'wporg-forums' );
     298                /* translators: %s: theme support forum URL */
     299                $report = __( 'If you are reporting an issue with this theme, please post <a href="%s">here</a> instead.', 'wporg-forums' );
    275300                $rate   = __( 'In order to rate a theme, you must also submit a review.', 'wporg-forums' );
    276301                break;
     
    279304        <p><?php _e( 'When posting a review, follow these guidelines:', 'wporg-forums' ); ?></p>
    280305        <ul>
    281             <li><?php printf( esc_html( $report ), sprintf( '<a href="%s">%s</a>',
    282                     esc_url( sprintf( 'https://wordpress.org/support/%s/%s/', $this->compat, $this->slug ) ),
    283                     _x( 'here', 'please post here instead', 'wporg-forums' )
    284                 ) ); ?></li>
     306            <li><?php printf( esc_html( $report ), esc_url( sprintf( 'https://wordpress.org/support/%s/%s/', $this->compat, $this->slug ) ) ); ?></li>
    285307            <li><?php echo esc_html( $rate ); ?></li>
    286308            <li><?php esc_html_e( 'Please provide as much detail as you can to justify your rating and to help others.', 'wporg-forums' ); ?></li>
Note: See TracChangeset for help on using the changeset viewer.