Making WordPress.org


Ignore:
Timestamp:
07/22/2015 11:07:44 AM (9 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.

File:
1 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        }
Note: See TracChangeset for help on using the changeset viewer.