app/Services/ModuleService.php
private function moduleSorter(): Closure
    {
        return static function (ModuleInterface $x, ModuleInterface $y): int {
            $title1 = $x instanceof ModuleLanguageInterface ? $x->locale()->endonymSortable() : $x->title();
            $title2 = $y instanceof ModuleLanguageInterface ? $y->locale()->endonymSortable() : $y->title();

            return I18N::strcasecmp($title1, $title2);
        };
    }
private function moduleSorter(): Closure
    {
        return static function (ModuleInterface $x, ModuleInterface $y): int {
            $title1 = $x instanceof ModuleLanguageInterface ? $x->locale()->endonymSortable() : $x->title();
            $title2 = $y instanceof ModuleLanguageInterface ? $y->locale()->endonymSortable() : $y->title();

            return I18N::strcasecmp($title1, $title2);
        };
    }
private function moduleSorter ( ) : Closure { return static function ( ModuleInterface $ x , ModuleInterface $ y ) : int { $ title1 = $ x instanceof ModuleLanguageInterface ? $ x -> locale ( ) -> endonymSortable ( ) : $ x -> title ( ) ; $ title2 = $ y instanceof ModuleLanguageInterface ? $ y -> locale ( ) -> endonymSortable ( ) : $ y -> title ( ) ; return I18N :: strcasecmp ( $ title1 , $ title2 ) ; } ; }
A function to sort modules by name.

Languages have a "sortable" name, so that "British English" sorts as "English, British".
This provides a more natural order in the language menu.

@return Closure
A function to sort modules by name .