WordPress.org

Making WordPress.org

Changeset 10159


Ignore:
Timestamp:
08/13/2020 02:43:12 AM (4 months ago)
Author:
dd32
Message:

Translate: On plugin listing pages, list the Stable translation projects prior to the Dev projects.

See #5368.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/locale-project.php

    r9816 r10159  
    190190                // Ensure consistent order of development and stable projects.
    191191                usort( $sub_projects, function( $a, $b ) {
    192                     return strnatcasecmp( $a->name, $b->name );
     192                    $a_is_dev = ( substr( $a->slug, 0, 3 ) == 'dev' );
     193                    $b_is_dev = ( substr( $b->slug, 0, 3 ) == 'dev' );
     194
     195                    // Sort same-type projects alphabetically
     196                    if ( $a_is_dev === $b_is_dev ) {
     197                        return strnatcasecmp( $a->name, $b->name );
     198                    }
     199
     200                    // Sort Stable before Dev.
     201                    return $a_is_dev <=> $b_is_dev;
    193202                } );
    194203            }
Note: See TracChangeset for help on using the changeset viewer.