instead of underscores so that it matches the output of {{NAMESPACE}} and related magic words.
solutions such as CSS-based overlays and ImageMap.
* (bug 368) Don't use caption for alt attribute; allow manual specification
using new "alt=" parameter for images
solutions such as CSS-based overlays and ImageMap.
* (bug 368) Don't use caption for alt attribute; allow manual specification
using new "alt=" parameter for images
+* (bug 44) The {{ns:}} core parser function now also accepts localized namespace
+ names and aliases; also, its output now uses spaces instead of underscores to
+ match the behavior of the {{NAMESPACE}} magic word
=== Bug fixes in 1.14 ===
=== Bug fixes in 1.14 ===
static function ns( $parser, $part1 = '' ) {
global $wgContLang;
static function ns( $parser, $part1 = '' ) {
global $wgContLang;
if ( intval( $part1 ) || $part1 == "0" ) {
if ( intval( $part1 ) || $part1 == "0" ) {
- $text = $wgContLang->getNsText( intval( $part1 ) );
- $found = true;
+ $index = intval( $part1 );
- $param = str_replace( ' ', '_', strtolower( $part1 ) );
- $index = MWNamespace::getCanonicalIndex( strtolower( $param ) );
- if ( !is_null( $index ) ) {
- $text = $wgContLang->getNsText( $index );
- $found = true;
- }
+ $index = $wgContLang->getNsIndex( str_replace( ' ', '_', $part1 ) );
- if ( $found ) {
- return $text;
+ if ( $index !== false ) {
+ return $wgContLang->getFormattedNsText( $index );
} else {
return array( 'found' => false );
}
} else {
return array( 'found' => false );
}