SkinTemplate: extract formatLanguageName() from outputPage()
authorMatmaRex <matma.rex@gmail.com>
Fri, 5 Oct 2012 16:00:49 +0000 (18:00 +0200)
committerMatmaRex <matma.rex@gmail.com>
Fri, 5 Oct 2012 16:00:49 +0000 (18:00 +0200)
This is to allow skins to override it; for example, CologneBlue needs the
names *not* to be uppercased, as they're not actually displayed in the
sidebar.

Change-Id: I91d505159c9e9e468182ebbff6002e5238e34f90

includes/SkinTemplate.php

index 457e35e..c654747 100644 (file)
@@ -423,7 +423,7 @@ class SkinTemplate extends Skin {
                                        if ( strval( $ilLangName ) === '' ) {
                                                $ilLangName = $l;
                                        } else {
-                                               $ilLangName = $this->getLanguage()->ucfirst( $ilLangName );
+                                               $ilLangName = $this->formatLanguageName( $ilLangName );
                                        }
                                        $language_urls[] = array(
                                                'href' => $nt->getFullURL(),
@@ -498,6 +498,17 @@ class SkinTemplate extends Skin {
                wfProfileOut( __METHOD__ );
        }
 
+       /**
+        * Format language name for use in sidebar interlanguage links list.
+        * By default it is capitalized.
+        *
+        * @param $name string Language name, e.g. "English" or "espaƱol"
+        * @private
+        */
+       function formatLanguageName( $name ) {
+               return $this->getLanguage()->ucfirst( $name );
+       }
+
        /**
         * Output the string, or print error message if it's
         * an error object of the appropriate type.