Merge "Fix edit link for messages in $wgForceUIMsgAsContentMsg"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 23 May 2015 14:27:19 +0000 (14:27 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 23 May 2015 14:27:19 +0000 (14:27 +0000)
includes/FileDeleteForm.php
includes/Message.php
includes/ProtectionForm.php
includes/page/Article.php
includes/specials/SpecialBlock.php
includes/specials/SpecialRevisiondelete.php
includes/specials/SpecialTags.php
includes/specials/SpecialUpload.php

index c1d14db..6d74af2 100644 (file)
@@ -296,7 +296,7 @@ class FileDeleteForm {
                        Xml::closeElement( 'form' );
 
                        if ( $wgUser->isAllowed( 'editinterface' ) ) {
-                               $title = Title::makeTitle( NS_MEDIAWIKI, 'Filedelete-reason-dropdown' );
+                               $title = wfMessage( 'filedelete-reason-dropdown' )->inContentLanguage()->getTitle();
                                $link = Linker::link(
                                        $title,
                                        wfMessage( 'filedelete-edit-reasonlist' )->escaped(),
index 4935e33..329d97a 100644 (file)
@@ -364,6 +364,31 @@ class Message implements MessageSpecifier {
                return new self( $keys );
        }
 
+       /**
+        * Get a title object for a mediawiki message, where it can be found in the mediawiki namespace.
+        * The title will be for the current language, if the message key is in
+        * $wgForceUIMsgAsContentMsg it will be append with the language code (except content
+        * language), because Message::inContentLanguage will also return in user language.
+        *
+        * @see $wgForceUIMsgAsContentMsg
+        * @return Title
+        * @since 1.26
+        */
+       public function getTitle() {
+               global $wgContLang, $wgForceUIMsgAsContentMsg;
+
+               $code = $this->language->getCode();
+               $title = $this->key;
+               if (
+                       $wgContLang->getCode() !== $code
+                       && in_array( $this->key, (array)$wgForceUIMsgAsContentMsg )
+               ) {
+                       $title .= '/' . $code;
+               }
+
+               return Title::makeTitle( NS_MEDIAWIKI, $wgContLang->ucfirst( strtr( $title, ' ', '_' ) ) );
+       }
+
        /**
         * Adds parameters to the parameter list of this message.
         *
index c546de7..69b64dd 100644 (file)
@@ -541,9 +541,8 @@ class ProtectionForm {
                $out .= Xml::closeElement( 'fieldset' );
 
                if ( $user->isAllowed( 'editinterface' ) ) {
-                       $title = Title::makeTitle( NS_MEDIAWIKI, 'Protect-dropdown' );
                        $link = Linker::link(
-                               $title,
+                               $context->msg( 'protect-dropdown' )->inContentLanguage()->getTitle(),
                                $context->msg( 'protect-edit-reasonlist' )->escaped(),
                                array(),
                                array( 'action' => 'edit' )
index f6074eb..48f3161 100644 (file)
@@ -1772,9 +1772,8 @@ class Article implements Page {
                        Xml::closeElement( 'form' );
 
                        if ( $user->isAllowed( 'editinterface' ) ) {
-                               $dropdownTitle = Title::makeTitle( NS_MEDIAWIKI, 'Deletereason-dropdown' );
                                $link = Linker::link(
-                                       $dropdownTitle,
+                                       $ctx->msg( 'deletereason-dropdown' )->inContentLanguage()->getTitle(),
                                        wfMessage( 'delete-edit-reasonlist' )->escaped(),
                                        array(),
                                        array( 'action' => 'edit' )
index 323575a..752edc3 100644 (file)
@@ -395,7 +395,7 @@ class SpecialBlock extends FormSpecialPage {
                # Link to edit the block dropdown reasons, if applicable
                if ( $user->isAllowed( 'editinterface' ) ) {
                        $links[] = Linker::link(
-                               Title::makeTitle( NS_MEDIAWIKI, 'Ipbreason-dropdown' ),
+                               $this->msg( 'ipbreason-dropdown' )->inContentLanguage()->getTitle(),
                                $this->msg( 'ipb-edit-dropdown' )->escaped(),
                                array(),
                                array( 'action' => 'edit' )
index c044146..21867b5 100644 (file)
@@ -450,9 +450,8 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                                Xml::closeElement( 'form' ) . "\n";
                        // Show link to edit the dropdown reasons
                        if ( $this->getUser()->isAllowed( 'editinterface' ) ) {
-                               $title = Title::makeTitle( NS_MEDIAWIKI, 'Revdelete-reason-dropdown' );
                                $link = Linker::link(
-                                       $title,
+                                       $this->msg( 'revdelete-reason-dropdown' )->inContentLanguage()->getTitle(),
                                        $this->msg( 'revdelete-edit-reasonlist' )->escaped(),
                                        array(),
                                        array( 'action' => 'edit' )
index 0b8147e..64c2cf3 100644 (file)
@@ -160,7 +160,7 @@ class SpecialTags extends SpecialPage {
                if ( $user->isAllowed( 'editinterface' ) ) {
                        $disp .= ' ';
                        $editLink = Linker::link(
-                               Title::makeTitle( NS_MEDIAWIKI, "Tag-$tag" ),
+                               $this->msg( "tag-$tag" )->inContentLanguage()->getTitle(),
                                $this->msg( 'tags-edit' )->escaped()
                        );
                        $disp .= $this->msg( 'parentheses' )->rawParams( $editLink )->escaped();
@@ -172,7 +172,7 @@ class SpecialTags extends SpecialPage {
                if ( $user->isAllowed( 'editinterface' ) ) {
                        $desc .= ' ';
                        $editDescLink = Linker::link(
-                               Title::makeTitle( NS_MEDIAWIKI, "Tag-$tag-description" ),
+                               $this->msg( "tag-$tag-description" )->inContentLanguage()->getTitle(),
                                $this->msg( 'tags-edit' )->escaped()
                        );
                        $desc .= $this->msg( 'parentheses' )->rawParams( $editDescLink )->escaped();
index 2d8f978..1618527 100644 (file)
@@ -818,7 +818,7 @@ class UploadForm extends HTMLForm {
                # Add a link to edit MediaWik:Licenses
                if ( $this->getUser()->isAllowed( 'editinterface' ) ) {
                        $licensesLink = Linker::link(
-                               Title::makeTitle( NS_MEDIAWIKI, 'Licenses' ),
+                               $this->msg( 'licenses' )->inContentLanguage()->getTitle(),
                                $this->msg( 'licenses-edit' )->escaped(),
                                array(),
                                array( 'action' => 'edit' )