WordPress.org

Making WordPress.org

Changeset 1778


Ignore:
Timestamp:
07/22/2015 11:07:44 AM (7 years ago)
Author:
ocean90
Message:

Translate: Improve rounding of percentages and make them visible for all sub-projects.

see https://wordpress.slack.com/archives/meta-i18n/p1437561221000313.
see #1091.

Location:
sites/trunk/translate.wordpress.org
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-routes/routes/locale.php

    r1777 r1778  
    248248
    249249            if ( $status->all_count ) {
    250                 $status->percent_complete = ceil( $status->current_count / $status->all_count * 100 );
     250                /*
     251                 * > 50% round down, so that a project with all strings except 1 translated shows 99%, instead of 100%.
     252                 * < 50% round up, so that a project with just a few strings shows 1%, instead of 0%.
     253                 */
     254                $percent_complete = ( $status->current_count / $status->all_count * 100 );
     255                $status->percent_complete = ( $percent_complete > 50 ) ? floor( $percent_complete ) : ceil( $percent_complete );
    251256            }
    252257        }
  • sites/trunk/translate.wordpress.org/public_html/gp-templates/locale-project.php

    r1768 r1778  
    111111                    <td class="set-name">
    112112                        <strong><?php gp_link( gp_url_project( $sub_project->path, gp_url_join( $locale->slug, $set_slug ) ), $sub_project->name ); ?></strong>
    113                         <?php if ( $sub_project_status->percent_complete > 90 ):
    114                             ?>
    115                             <span class="bubble morethan90"><?php echo $sub_project_status->percent_complete; ?>%</span>
    116                         <?php endif;?>
     113                        <?php if ( $sub_project_status->percent_complete > 90 ) : ?>
     114                            <span class="sub-project-status percent-90"><?php echo $sub_project_status->percent_complete; ?>%</span>
     115                        <?php else : ?>
     116                            <span class="sub-project-status"><?php echo $sub_project_status->percent_complete; ?>%</span>
     117                        <?php endif; ?>
    117118                    </td>
    118119                    <td class="stats translated">
     
    141142                    <td class="set-name">
    142143                        <strong><?php gp_link( gp_url_project( $sub_project->path, gp_url_join( $locale->slug, $set_slug ) ), $sub_project->name ); ?></strong>
    143                         <?php if ( $status->percent_complete > 90 ):
    144                             ?>
    145                             <span class="bubble morethan90"><?php echo $status->percent_complete; ?>%</span>
    146                         <?php endif;?>
     144                        <?php if ( $status->percent_complete > 90 ) : ?>
     145                            <span class="sub-project-status percent-90"><?php echo $status->percent_complete; ?>%</span>
     146                        <?php else : ?>
     147                            <span class="sub-project-status"><?php echo $status->percent_complete; ?>%</span>
     148                        <?php endif; ?>
    147149                    </td>
    148150                    <td class="stats translated">
  • sites/trunk/translate.wordpress.org/public_html/gp-templates/style.css

    r1761 r1778  
    798798}
    799799
     800.locale-sub-projects .sub-project-status {
     801    font-size: 90%;
     802    color: #a0a5aa;
     803    padding-left: .5em;
     804}
     805
     806.locale-sub-projects .sub-project-status.percent-90 {
     807    color: #509040;
     808}
     809
    800810/* Responsive styles */
    801811@media (max-width: 700px) {
Note: See TracChangeset for help on using the changeset viewer.