* @return Language
*/
static function factory( $code ) {
- global $wgLangObjCacheSize;
+ global $wgDummyLanguageCodes, $wgLangObjCacheSize;
+
+ if ( isset( $wgDummyLanguageCodes[$code] ) ) {
+ $code = $wgDummyLanguageCodes[$code];
+ }
// get the language object to process
$langObj = isset( self::$mLangObjCache[$code] )
throw new MWException( "Invalid fallback sequence for language '$code'" );
}
+ /**
+ * Checks whether any localisation is available for that language tag
+ * in MediaWiki (MessagesXx.php exists).
+ *
+ * @param string $code Language tag (in lower case)
+ * @return bool Whether language is supported
+ * @since 1.21
+ */
+ public static function isSupportedLanguage( $code ) {
+ return is_readable( self::getMessagesFileName( $code ) );
+ }
+
/**
* Returns true if a language code string is of a valid form, whether or
* not it exists. This includes codes which are used solely for