28 private readonly
Language $contentLanguage
30 parent::__construct(
'NamespaceInfo' );
45 $this->
msg(
'namespaceinfo-heading-id' )->text()
50 $this->
msg(
'namespaceinfo-heading-canonical' )->text()
55 $this->
msg(
'namespaceinfo-heading-local' )->text()
60 $this->
msg(
'namespaceinfo-heading-aliases' )->text()
65 $this->
msg(
'namespaceinfo-heading-info' )->text()
67 $tableHeadingRow = Html::rawElement(
70 $idHeading . $canonicalHeading . $localHeading . $aliasHeading . $infoHeading
73 $allAliases = $this->contentLanguage->getNamespaceAliases();
76 foreach ( $allAliases as $alias => $ns ) {
77 $aliases[$ns][] = $alias;
81 foreach ( $this->
getContentLanguage()->getFormattedNamespaces() as $ns => $localName ) {
86 $table = Html::rawElement(
88 [
'class' =>
'wikitable' ],
89 $tableHeadingRow . $tableBodyRows
92 $out->addHtml( $table );
102 private function makeNamespaceRow(
int $ns,
string $localName, array $aliases = [] ): 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',
132 $description = $this->
msg(
'namespaceinfo-description-custom', $localName );
135 $descriptionText = $description->parse();
141 if ( isset( $namespaceProtection[$ns] ) ) {
142 $rightsNeeded = $namespaceProtection[$ns];
143 if ( !is_array( $rightsNeeded ) ) {
144 $rightsNeeded = [ $rightsNeeded ];
146 foreach ( $rightsNeeded as $right ) {
147 $properties[] = $this->
msg(
'namespaceinfo-namespace-protection-right', $right )
152 if ( !$this->namespaceInfo->isMovable( $ns ) ) {
153 $properties[] = $this->
msg(
'namespaceinfo-namespace-immovable' )->parse();
155 if ( $this->namespaceInfo->isContent( $ns ) ) {
156 $properties[] = $this->
msg(
'namespaceinfo-namespace-iscontent' )->parse();
158 if ( $this->namespaceInfo->hasSubpages( $ns ) ) {
159 $properties[] = $this->
msg(
'namespaceinfo-namespace-subpages' )->parse();
161 if ( $this->namespaceInfo->isNonincludable( $ns ) ) {
162 $properties[] = $this->
msg(
'namespaceinfo-namespace-nonincludable' )->parse();
164 $contentModel = $this->namespaceInfo->getNamespaceContentModel( $ns );
165 if ( $contentModel !==
null ) {
166 $properties[] = $this->
msg(
'namespaceinfo-namespace-default-contentmodel' )
167 ->params( $contentModel )
173 $namespaceProperties =
'';
174 if ( $properties !== [] ) {
175 $namespaceProperties = Html::openElement(
'ul' );
176 foreach ( $properties as $propertyText ) {
177 $namespaceProperties .= Html::rawElement(
183 $namespaceProperties .= Html::closeElement(
'ul' );
187 if ( $aliases !== [] ) {
188 if ( count( $aliases ) === 1 ) {
192 foreach ( $aliases as $alias ) {
194 $alias = str_replace(
"_",
" ", $alias );
206 $idField = Html::rawElement(
'td', [], (
string)$ns );
207 $canonicalField = Html::rawElement(
'td', [], $canonicalName );
208 $localField = Html::rawElement(
'td', [], $localName );
210 $infoField = Html::rawElement(
'td', [], $descriptionText . $namespaceProperties );
212 return Html::rawElement(
215 $idField . $canonicalField . $localField . $aliasesField . $infoField