Making WordPress.org

Changeset 4230


Ignore:
Timestamp:
10/12/2016 08:28:51 PM (8 years ago)
Author:
coffee2code
Message:

Support Forums: Allow for pluralization of the string for the number of stars in the ratings widget.

Syncs the ratings widget with changes made to the old plugin directory a year ago to handle just this very thing.

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

    r4229 r4230  
    155155                );
    156156                /* translators: %d: number of stars */
    157                 $stars_text = sprintf( __( '%d stars', 'wporg-forums' ), $rating );
     157                $stars_text = sprintf(
     158                    /* translators: %d: number of stars */
     159                    _n( '%d star', '%d stars', $rating, 'wporg-forums' ),
     160                    $rating
     161                );
    158162                $width = 0;
    159163                if ( $ratings_count && $ratings_count_total ) {
    160                     $width = 92 * ( $ratings_count / $ratings_count_total );
     164                    $width = 100 * ( $ratings_count / $ratings_count_total );
    161165                }
    162166                ?>
     
    164168                <a href="<?php echo esc_url( sprintf( 'https://wordpress.org/support/%s/%s/reviews/?filter=%s', $this->compat, $this->slug, $rating ) ); ?>"
    165169                    title="<?php echo esc_attr( $stars_title ); ?>">
    166                     <span class="counter-label" style="float:left;margin-right:5px;"><?php echo esc_html( $stars_text ); ?></span>
    167                     <span class="counter-back" style="height:17px;width:92px;background-color:#ececec;float:left;">
     170                    <span class="counter-label" style="float:left;margin-right:5px;min-width:58px;"><?php echo esc_html( $stars_text ); ?></span>
     171                    <span class="counter-back" style="height:17px;width:100px;background-color:#ececec;float:left;">
    168172                        <span class="counter-bar" style="width:<?php echo esc_attr( $width ); ?>px;height:17px;background-color:#ffc733;float:left;"></span>
    169173                    </span>
Note: See TracChangeset for help on using the changeset viewer.