* @return \type{\string} Namespace text
*/
public function getNsText() {
- global $wgContLang, $wgCanonicalNamespaceNames;
+ global $wgCanonicalNamespaceNames;
if ( '' != $this->mInterwiki ) {
// This probably shouldn't even happen. ohh man, oh yuck.
return $wgCanonicalNamespaceNames[$this->mNamespace];
}
}
+
+ return $this->getNsTextInternal( $this->mNamespace );
+ }
+
+ function getNsTextInternal( $namespace) {
+ global $wgContLang, $wgSlowGenderAliases, $wgTitle, $title;
+ if( $namespace === NS_USER || $namespace === NS_USER_TALK ) {
+ static $gender = null;
+
+ $name = $this->getBaseText();
+ if( !isset($gender[$name] ) ) {
+ $gender[$name] = User::getDefaultOption( 'gender' );
+
+ // wgTitle may not be defined
+ $mytitle = isset($wgTitle) ? $wgTitle: Title::newFromText($title);
+
+ // Check stuff
+ if ( $wgSlowGenderAliases ||
+ // Needs to be checked always to produce desired
+ // effect when viewing user pages
+ ($mytitle && $name === $mytitle->getBaseText()) ) {
+
+ $user = User::newFromName( $name );
+ if ( $user ) $gender[$name] = $user->getOption( 'gender' );
+ }
+ }
+
+ return $wgContLang->getGenderNsText( $this->mNamespace, $gender[$name] );
+ }
return $wgContLang->getNsText( $this->mNamespace );
}
/**
* @return \type{\string} Namespace text
*/
public function getSubjectNsText() {
- global $wgContLang;
- return $wgContLang->getNsText( MWNamespace::getSubject( $this->mNamespace ) );
+ return $this->getNsTextInternal( MWNamespace::getSubject( $this->mNamespace ) );
}
/**
* Get the namespace text of the talk page
* @return \type{\string} Namespace text
*/
public function getTalkNsText() {
- global $wgContLang;
- return( $wgContLang->getNsText( MWNamespace::getTalk( $this->mNamespace ) ) );
+ return $this->getNsTextInternal( MWNamespace::getTalk( $this->mNamespace ) );
}
/**
* Could this title have a corresponding talk page?