Alex Monk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/294199

Change subject: Fix preference namespace list for namespaces specified by name 
instead of index
......................................................................

Fix preference namespace list for namespaces specified by name instead of index

Change-Id: I9202066d23eca527571ac817cf3ae64bc2d57bea
---
M VisualEditor.hooks.php
1 file changed, 7 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/99/294199/1

diff --git a/VisualEditor.hooks.php b/VisualEditor.hooks.php
index fe4368f..9b8f812 100644
--- a/VisualEditor.hooks.php
+++ b/VisualEditor.hooks.php
@@ -492,15 +492,17 @@
        }
 
        /**
-        * Convert a namespace index to the local text for display to the user.
+        * Convert a namespace to the local text for display to the user.
         *
-        * @param $nsIndex int
+        * @param $ns int|string
         * @return string
         */
-       private static function convertNs( $nsIndex ) {
+       private static function convertNs( $ns ) {
                global $wgLang;
-               if ( $nsIndex ) {
-                       return $wgLang->convertNamespace( $nsIndex );
+               if ( is_integer( $ns ) && $ns ) {
+                       return $wgLang->convertNamespace( $ns );
+               } else if ( $ns ) {
+                       return $wgLang->convertNamespace( 
MWNamespace::getCanonicalIndex( strtolower( $ns ) ) );
                } else {
                        return wfMessage( 'blanknamespace' )->text();
                }

-- 
To view, visit https://gerrit.wikimedia.org/r/294199
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9202066d23eca527571ac817cf3ae64bc2d57bea
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Alex Monk <kren...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to