41 parent::__construct(
'NamespaceInfo' );
43 $this->namespaceInfo = $namespaceInfo;
58 $this->
msg(
'namespaceinfo-heading-id' )->text()
63 $this->
msg(
'namespaceinfo-heading-canonical' )->text()
68 $this->
msg(
'namespaceinfo-heading-local' )->text()
73 $this->
msg(
'namespaceinfo-heading-info' )->text()
75 $tableHeadingRow = Html::rawElement(
78 $idHeading . $canonicalHeading . $localHeading . $infoHeading
82 foreach ( $this->
getContentLanguage()->getFormattedNamespaces() as $ns => $localName ) {
83 $tableBodyRows .= $this->makeNamespaceRow( $ns, $localName );
86 $table = Html::rawElement(
88 [
'class' =>
'wikitable' ],
89 $tableHeadingRow . $tableBodyRows
92 $out->addHtml( $table );
102 private function makeNamespaceRow(
int $ns,
string $localName ): string {
103 $canonicalName = $this->namespaceInfo->getCanonicalName( $ns );
104 if ( $canonicalName ) {
105 $canonicalName = strtr( $canonicalName,
'_',
' ' );
112 $localName = $this->
msg(
'blanknamespace' )->escaped();
113 $canonicalName = $this->
msg(
'blanknamespace' )->inLanguage(
'en' )->escaped();
116 $description = $this->
msg(
'namespaceinfo-description-ns' . $ns );
117 if ( $description->isDisabled() ) {
120 if ( $this->namespaceInfo->isTalk( $ns ) ) {
121 $subjectNs = $this->namespaceInfo->getSubject( $ns );
122 $subjectName = strtr(
123 $this->namespaceInfo->getCanonicalName( $subjectNs ),
127 $description = $this->
msg(
'namespaceinfo-description-custom-talk' )
133 $description = $this->
msg(
'namespaceinfo-description-custom' )
134 ->params( $localName );
137 $descriptionText = $description->parse();
142 $namespaceProtection = $this->
getConfig()->get(
'NamespaceProtection' );
143 if ( isset( $namespaceProtection[$ns] ) ) {
144 $rightsNeeded = $namespaceProtection[$ns];
145 if ( !is_array( $rightsNeeded ) ) {
146 $rightsNeeded = [ $rightsNeeded ];
148 foreach ( $rightsNeeded as $right ) {
149 $properties[] = $this->
msg(
'namespaceinfo-namespace-protection-right' )
155 if ( !$this->namespaceInfo->isMovable( $ns ) ) {
156 $properties[] = $this->
msg(
'namespaceinfo-namespace-immovable' )->parse();
158 if ( $this->namespaceInfo->isContent( $ns ) ) {
159 $properties[] = $this->
msg(
'namespaceinfo-namespace-iscontent' )->parse();
161 if ( $this->namespaceInfo->hasSubpages( $ns ) ) {
162 $properties[] = $this->
msg(
'namespaceinfo-namespace-subpages' )->parse();
164 if ( $this->namespaceInfo->isNonincludable( $ns ) ) {
165 $properties[] = $this->
msg(
'namespaceinfo-namespace-nonincludable' )->parse();
167 if ( $this->namespaceInfo->getNamespaceContentModel( $ns ) !==
null ) {
168 $properties[] = $this->
msg(
'namespaceinfo-namespace-default-contentmodel' )
169 ->params( $this->namespaceInfo->getNamespaceContentModel( $ns ) )
175 $namespaceProperties =
'';
176 if ( $properties !== [] ) {
177 $namespaceProperties = Html::openElement(
'ul' );
178 foreach ( $properties as $propertyText ) {
179 $namespaceProperties .= Html::rawElement(
185 $namespaceProperties .= Html::closeElement(
'ul' );
188 $idField = Html::rawElement(
'td', [], (
string)$ns );
189 $canonicalField = Html::rawElement(
'td', [], $canonicalName );
190 $localField = Html::rawElement(
'td', [], $localName );
191 $infoField = Html::rawElement(
'td', [], $descriptionText . $namespaceProperties );
193 return Html::rawElement(
196 $idField . $canonicalField . $localField . $infoField