From: robin Date: Wed, 9 May 2012 23:39:11 +0000 (+0200) Subject: fetchLanguageNames: fallback to default instead of false X-Git-Tag: 1.31.0-rc.0~23570^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/recherche.php?a=commitdiff_plain;h=aed0328558c299d63bf94415d15d9314d1377ca5;p=lhc%2Fweb%2Fwiklou.git fetchLanguageNames: fallback to default instead of false In Language::fetchLanguageNames, fallback to the default option (mw) instead of returning false if none of the three options (all/mw/mwfile) is recognized Change-Id: I743540bb0d1e7572a5a7e2f4ed9b57e7552d99b2 --- diff --git a/languages/Language.php b/languages/Language.php index e6feb45edf..b36732b2d9 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -700,9 +700,9 @@ class Language { * Use null for autonyms (native names) * @param $include string: * 'all' all available languages - * 'mw' only if the language is defined in MediaWiki or wgExtraLanguageNames + * '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|bool: language code => language name, false if $include is wrong + * @return array: language code => language name * @since 1.20 */ public static function fetchLanguageNames( $inLanguage = null, $include = 'mw' ) { @@ -740,9 +740,7 @@ class Language { $returnMw[$coreCode] = $names[$coreCode]; } - if( $include === 'mw' ) { - return $returnMw; - } elseif( $include === 'mwfile' ) { + if( $include === 'mwfile' ) { $namesMwFile = array(); # We do this using a foreach over the codes instead of a directory # loop so that messages files in extensions will work correctly. @@ -753,7 +751,8 @@ class Language { } return $namesMwFile; } - return false; + # 'mw' option; default if it's not one of the other two options (all/mwfile) + return $returnMw; } /**