27 parent::__construct(
'NamespaceInfo' );
29 $this->namespaceInfo = $namespaceInfo;
44 $this->
msg(
'namespaceinfo-heading-id' )->text()
49 $this->
msg(
'namespaceinfo-heading-canonical' )->text()
54 $this->
msg(
'namespaceinfo-heading-local' )->text()
59 $this->
msg(
'namespaceinfo-heading-info' )->text()
61 $tableHeadingRow = Html::rawElement(
64 $idHeading . $canonicalHeading . $localHeading . $infoHeading
68 foreach ( $this->
getContentLanguage()->getFormattedNamespaces() as $ns => $localName ) {
69 $tableBodyRows .= $this->makeNamespaceRow( $ns, $localName );
72 $table = Html::rawElement(
74 [
'class' =>
'wikitable' ],
75 $tableHeadingRow . $tableBodyRows
78 $out->addHtml( $table );
88 private function makeNamespaceRow(
int $ns,
string $localName ): string {
89 $canonicalName = $this->namespaceInfo->getCanonicalName( $ns );
90 if ( $canonicalName ) {
91 $canonicalName = strtr( $canonicalName,
'_',
' ' );
98 $localName = $this->
msg(
'blanknamespace' )->escaped();
99 $canonicalName = $this->
msg(
'blanknamespace' )->inLanguage(
'en' )->escaped();
102 $description = $this->
msg(
'namespaceinfo-description-ns' . $ns );
103 if ( $description->isDisabled() ) {
106 if ( $this->namespaceInfo->isTalk( $ns ) ) {
107 $subjectNs = $this->namespaceInfo->getSubject( $ns );
108 $subjectName = strtr(
109 $this->namespaceInfo->getCanonicalName( $subjectNs ),
113 $description = $this->
msg(
'namespaceinfo-description-custom-talk' )
119 $description = $this->
msg(
'namespaceinfo-description-custom' )
120 ->params( $localName );
123 $descriptionText = $description->parse();
128 $namespaceProtection = $this->
getConfig()->get(
'NamespaceProtection' );
129 if ( isset( $namespaceProtection[$ns] ) ) {
130 $rightsNeeded = $namespaceProtection[$ns];
131 if ( !is_array( $rightsNeeded ) ) {
132 $rightsNeeded = [ $rightsNeeded ];
134 foreach ( $rightsNeeded as $right ) {
135 $properties[] = $this->
msg(
'namespaceinfo-namespace-protection-right' )
141 if ( !$this->namespaceInfo->isMovable( $ns ) ) {
142 $properties[] = $this->
msg(
'namespaceinfo-namespace-immovable' )->parse();
144 if ( $this->namespaceInfo->isContent( $ns ) ) {
145 $properties[] = $this->
msg(
'namespaceinfo-namespace-iscontent' )->parse();
147 if ( $this->namespaceInfo->hasSubpages( $ns ) ) {
148 $properties[] = $this->
msg(
'namespaceinfo-namespace-subpages' )->parse();
150 if ( $this->namespaceInfo->isNonincludable( $ns ) ) {
151 $properties[] = $this->
msg(
'namespaceinfo-namespace-nonincludable' )->parse();
153 if ( $this->namespaceInfo->getNamespaceContentModel( $ns ) !==
null ) {
154 $properties[] = $this->
msg(
'namespaceinfo-namespace-default-contentmodel' )
155 ->params( $this->namespaceInfo->getNamespaceContentModel( $ns ) )
161 $namespaceProperties =
'';
162 if ( $properties !== [] ) {
163 $namespaceProperties = Html::openElement(
'ul' );
164 foreach ( $properties as $propertyText ) {
165 $namespaceProperties .= Html::rawElement(
171 $namespaceProperties .= Html::closeElement(
'ul' );
174 $idField = Html::rawElement(
'td', [], (
string)$ns );
175 $canonicalField = Html::rawElement(
'td', [], $canonicalName );
176 $localField = Html::rawElement(
'td', [], $localName );
177 $infoField = Html::rawElement(
'td', [], $descriptionText . $namespaceProperties );
179 return Html::rawElement(
182 $idField . $canonicalField . $localField . $infoField