// a custom language code might not have a defined name...
if ( !array_key_exists( $wgLanguageCode, $languages ) ) {
$languages[$wgLanguageCode] = $wgLanguageCode;
+ // Sort the array again
+ ksort( $languages );
}
- ksort( $languages );
-
/**
* If a bogus value is set, default to the content language.
* Otherwise, no default is selected and the user ends up
$unwantedLanguageCodes = $wgExtraLanguageCodes +
LanguageCode::getDeprecatedCodeMapping();
$languages = Language::fetchLanguageNames();
- ksort( $languages );
foreach ( $languages as $code => $lang ) {
if ( isset( $unwantedLanguageCodes[$code] ) ) {
continue;
$languageCode = $this->config->get( 'LanguageCode' );
if ( !array_key_exists( $languageCode, $languages ) ) {
$languages[$languageCode] = $languageCode;
+ // Sort the array again
+ ksort( $languages );
}
- ksort( $languages );
$options = [];
foreach ( $languages as $code => $name ) {
// Building a language selector
$userLang = $this->getLanguage()->getCode();
$languages = Language::fetchLanguageNames( $userLang, 'mwfile' );
- ksort( $languages );
$options = [];
foreach ( $languages as $code => $name ) {
$options["$code - $name"] = $code;
* 'all' all available languages
* 'mw' only if the language is defined in MediaWiki or wgExtraLanguageNames (default)
* 'mwfile' only if the language is in 'mw' *and* has a message file
- * @return array Language code => language name
+ * @return array Language code => language name (sorted by key)
* @since 1.20
*/
public static function fetchLanguageNames( $inLanguage = null, $include = 'mw' ) {
* 'all' all available languages
* 'mw' only if the language is defined in MediaWiki or wgExtraLanguageNames (default)
* 'mwfile' only if the language is in 'mw' *and* has a message file
- * @return array Language code => language name
+ * @return array Language code => language name (sorted by key)
*/
private static function fetchLanguageNamesUncached( $inLanguage = null, $include = 'mw' ) {
global $wgExtraLanguageNames, $wgUsePigLatinVariant;