Making WordPress.org

Changeset 11346


Ignore:
Timestamp:
11/29/2021 05:33:48 PM (3 years ago)
Author:
ocean90
Message:

Translate, Consistency: Group results by translation and project path.

Fixes #5967.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/inc/routes/class-consistency.php

    r11345 r11346  
    169169        }
    170170
    171         // Group by translation. Done in PHP because it's faster as in MySQL.
     171        // Group by translation and project path. Done in PHP because it's faster as in MySQL.
    172172        usort( $results, [ $this, '_sort_callback' ] );
    173173
     
    176176
    177177    public function _sort_callback( $a, $b ) {
    178         return strnatcmp( $a->translation, $b->translation );
     178        $sort = strnatcmp( $a->translation . $a->original_context, $b->translation . $b->original_context );
     179        if ( 0 === $sort ) {
     180            $sort = strnatcmp( $a->project_path, $b->project_path );
     181        }
     182
     183        return $sort;
    179184    }
    180185}
Note: See TracChangeset for help on using the changeset viewer.