(bug 41477) Add Language::isSupportedLanguage
[lhc/web/wiklou.git] / languages / Language.php
index 0a1cd37..7a62112 100644 (file)
@@ -245,6 +245,18 @@ class Language {
                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