Index: trunk/phase3/includes/Title.php |
— | — | @@ -1645,12 +1645,7 @@ |
1646 | 1646 | $m = array(); |
1647 | 1647 | if ( preg_match( "/^(.+?)_*:_*(.*)$/S", $dbkey, $m ) ) { |
1648 | 1648 | $p = $m[1]; |
1649 | | - $lowerNs = $wgContLang->lc( $p ); |
1650 | | - if ( $ns = Namespace::getCanonicalIndex( $lowerNs ) ) { |
1651 | | - # Canonical namespace |
1652 | | - $dbkey = $m[2]; |
1653 | | - $this->mNamespace = $ns; |
1654 | | - } elseif ( $ns = $wgContLang->getNsIndex( $lowerNs )) { |
| 1649 | + if ( $ns = $wgContLang->getNsIndex( $p )) { |
1655 | 1650 | # Ordinary namespace |
1656 | 1651 | $dbkey = $m[2]; |
1657 | 1652 | $this->mNamespace = $ns; |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -228,14 +228,30 @@ |
229 | 229 | } |
230 | 230 | |
231 | 231 | /** |
232 | | - * Get a namespace key by value, case insensetive. |
| 232 | + * Get a namespace key by value, case insensitive. |
| 233 | + * Only matches namespace names for the current language, not the |
| 234 | + * canonical ones defined in Namespace.php. |
233 | 235 | * |
234 | 236 | * @param string $text |
235 | 237 | * @return mixed An integer if $text is a valid value otherwise false |
236 | 238 | */ |
| 239 | + function getLocalNsIndex( $text ) { |
| 240 | + $this->load(); |
| 241 | + $lctext = $this->lc($text); |
| 242 | + return isset( $this->mNamespaceIds[$lctext] ) ? $this->mNamespaceIds[$lctext] : false; |
| 243 | + } |
| 244 | + |
| 245 | + /** |
| 246 | + * Get a namespace key by value, case insensitive. Canonical namespace |
| 247 | + * names override custom ones defined for the current language. |
| 248 | + * |
| 249 | + * @param string $text |
| 250 | + * @return mixed An integer if $text is a valid value otherwise false |
| 251 | + */ |
237 | 252 | function getNsIndex( $text ) { |
238 | 253 | $this->load(); |
239 | 254 | $lctext = $this->lc($text); |
| 255 | + if( ( $ns = Namespace::getCanonicalIndex( $lctext ) ) !== null ) return $ns; |
240 | 256 | return isset( $this->mNamespaceIds[$lctext] ) ? $this->mNamespaceIds[$lctext] : false; |
241 | 257 | } |
242 | 258 | |