only list languages with corresponding language files in the UI selection part
authorZheng Zhu <zhengzhu@users.mediawiki.org>
Wed, 22 Sep 2004 06:30:16 +0000 (06:30 +0000)
committerZheng Zhu <zhengzhu@users.mediawiki.org>
Wed, 22 Sep 2004 06:30:16 +0000 (06:30 +0000)
includes/SpecialPreferences.php

index 93fb091..ec54126 100644 (file)
@@ -396,8 +396,13 @@ class PreferencesForm {
                <div><label>$yl: <select name=\"wpUserLanguage\" />\n");
 
         foreach($wgLanguageNames as $code => $name) {
-            $sel = ($code == $this->mUserLanguage)? "selected" : "";
-            $wgOut->addHtml("\t<option value=\"$code\" $sel>$code - $name</option>\n");
+           global $IP;
+            /* only add languages that have a file */
+           $langfile="$IP/languages/Language".str_replace('-', '_', ucfirst($code)).".php";
+           if(file_exists($langfile)) {
+               $sel = ($code == $this->mUserLanguage)? "selected" : "";
+               $wgOut->addHtml("\t<option value=\"$code\" $sel>$code - $name</option>\n");
+           }
         }
         $wgOut->addHtml("</label></div>\n" );