27 parent::__construct(
'NamespaceInfo' );
42 $this->
msg(
'namespaceinfo-heading-id' )->text()
47 $this->
msg(
'namespaceinfo-heading-canonical' )->text()
52 $this->
msg(
'namespaceinfo-heading-local' )->text()
57 $this->
msg(
'namespaceinfo-heading-info' )->text()
59 $tableHeadingRow = Html::rawElement(
62 $idHeading . $canonicalHeading . $localHeading . $infoHeading
66 foreach ( $this->
getContentLanguage()->getFormattedNamespaces() as $ns => $localName ) {
67 $tableBodyRows .= $this->makeNamespaceRow( $ns, $localName );
70 $table = Html::rawElement(
72 [
'class' =>
'wikitable' ],
73 $tableHeadingRow . $tableBodyRows
76 $out->addHtml( $table );
86 private function makeNamespaceRow(
int $ns,
string $localName ): string {
87 $canonicalName = $this->namespaceInfo->getCanonicalName( $ns );
88 if ( $canonicalName ) {
89 $canonicalName = strtr( $canonicalName,
'_',
' ' );
96 $localName = $this->
msg(
'blanknamespace' )->escaped();
97 $canonicalName = $this->
msg(
'blanknamespace' )->inLanguage(
'en' )->escaped();
100 $description = $this->
msg(
'namespaceinfo-description-ns' . $ns );
101 if ( $description->isDisabled() ) {
104 if ( $this->namespaceInfo->isTalk( $ns ) ) {
105 $subjectNs = $this->namespaceInfo->getSubject( $ns );
106 $subjectName = strtr(
107 $this->namespaceInfo->getCanonicalName( $subjectNs ),
111 $description = $this->
msg(
'namespaceinfo-description-custom-talk',
116 $description = $this->
msg(
'namespaceinfo-description-custom', $localName );
119 $descriptionText = $description->parse();
124 $namespaceProtection = $this->
getConfig()->get(
'NamespaceProtection' );
125 if ( isset( $namespaceProtection[$ns] ) ) {
126 $rightsNeeded = $namespaceProtection[$ns];
127 if ( !is_array( $rightsNeeded ) ) {
128 $rightsNeeded = [ $rightsNeeded ];
130 foreach ( $rightsNeeded as $right ) {
131 $properties[] = $this->
msg(
'namespaceinfo-namespace-protection-right', $right )
136 if ( !$this->namespaceInfo->isMovable( $ns ) ) {
137 $properties[] = $this->
msg(
'namespaceinfo-namespace-immovable' )->parse();
139 if ( $this->namespaceInfo->isContent( $ns ) ) {
140 $properties[] = $this->
msg(
'namespaceinfo-namespace-iscontent' )->parse();
142 if ( $this->namespaceInfo->hasSubpages( $ns ) ) {
143 $properties[] = $this->
msg(
'namespaceinfo-namespace-subpages' )->parse();
145 if ( $this->namespaceInfo->isNonincludable( $ns ) ) {
146 $properties[] = $this->
msg(
'namespaceinfo-namespace-nonincludable' )->parse();
148 $contentModel = $this->namespaceInfo->getNamespaceContentModel( $ns );
149 if ( $contentModel !==
null ) {
150 $properties[] = $this->
msg(
'namespaceinfo-namespace-default-contentmodel' )
151 ->params( $contentModel )
157 $namespaceProperties =
'';
158 if ( $properties !== [] ) {
159 $namespaceProperties = Html::openElement(
'ul' );
160 foreach ( $properties as $propertyText ) {
161 $namespaceProperties .= Html::rawElement(
167 $namespaceProperties .= Html::closeElement(
'ul' );
170 $idField = Html::rawElement(
'td', [], (
string)$ns );
171 $canonicalField = Html::rawElement(
'td', [], $canonicalName );
172 $localField = Html::rawElement(
'td', [], $localName );
173 $infoField = Html::rawElement(
'td', [], $descriptionText . $namespaceProperties );
175 return Html::rawElement(
178 $idField . $canonicalField . $localField . $infoField