Preferences: Sort list of skins by internal name
authorBartosz Dziewoński <matma.rex@gmail.com>
Thu, 7 Dec 2017 18:37:08 +0000 (19:37 +0100)
committerBartosz Dziewoński <matma.rex@gmail.com>
Thu, 7 Dec 2017 19:01:11 +0000 (20:01 +0100)
Sort by the internal name, so that the ordering is the same for each
display language, especially if some skin names are translated to use
a different alphabet and some are not.

Bug: T181112
Change-Id: I763150cc578e9aa70990a53895c032f17d96e97a

includes/Preferences.php

index cab1e1f..e6a8bcc 100644 (file)
@@ -1171,15 +1171,15 @@ class Preferences {
                # Only show skins that aren't disabled in $wgSkipSkins
                $validSkinNames = Skin::getAllowedSkins();
 
-               # Sort by UI skin name. First though need to update validSkinNames as sometimes
-               # the skinkey & UI skinname differ (e.g. "standard" skinkey is "Classic" in the UI).
                foreach ( $validSkinNames as $skinkey => &$skinname ) {
                        $msg = $context->msg( "skinname-{$skinkey}" );
                        if ( $msg->exists() ) {
                                $skinname = htmlspecialchars( $msg->text() );
                        }
                }
-               asort( $validSkinNames );
+               # Sort by the internal name, so that the ordering is the same for each display language,
+               # especially if some skin names are translated to use a different alphabet and some are not.
+               ksort( $validSkinNames );
 
                $config = $context->getConfig();
                $defaultSkin = $config->get( 'DefaultSkin' );