Umherirrender has uploaded a new change for review.
https://gerrit.wikimedia.org/r/179630
Change subject: Fix edit link for messages in $wgForceUIMsgAsContentMsg
......................................................................
Fix edit link for messages in $wgForceUIMsgAsContentMsg
Some special pages or actions have a link for users with editinterface
rights to edit the message used in scroll down menu.
When the message is parsed for the scroll down menu the config
$wgForceUIMsgAsContentMsg is used, but that was not used for the edit
link.
Add a new function Message::makeTitle and use it in all places in core.
Most benefit will have the edit link for MediaWiki:Licenses on
Special:Upload, because commons has that message in
$wgForceUIMsgAsContentMsg.
Change-Id: Ib800b9adcc9ae88ef53228b66838bf61d2065f0f
---
M includes/FileDeleteForm.php
M includes/Message.php
M includes/ProtectionForm.php
M includes/page/Article.php
M includes/specials/SpecialBlock.php
M includes/specials/SpecialRevisiondelete.php
M includes/specials/SpecialTags.php
M includes/specials/SpecialUpload.php
8 files changed, 23 insertions(+), 8 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/30/179630/1
diff --git a/includes/FileDeleteForm.php b/includes/FileDeleteForm.php
index 1c709e6..ea73180 100644
--- a/includes/FileDeleteForm.php
+++ b/includes/FileDeleteForm.php
@@ -296,7 +296,7 @@
Xml::closeElement( 'form' );
if ( $wgUser->isAllowed( 'editinterface' ) ) {
- $title = Title::makeTitle( NS_MEDIAWIKI,
'Filedelete-reason-dropdown' );
+ $title = Message::makeTitle(
RequestContext::getMain(), 'Filedelete-reason-dropdown' );
$link = Linker::link(
$title,
wfMessage( 'filedelete-edit-reasonlist'
)->escaped(),
diff --git a/includes/Message.php b/includes/Message.php
index 93a37cb..c34341a 100644
--- a/includes/Message.php
+++ b/includes/Message.php
@@ -365,6 +365,21 @@
}
/**
+ * Get a title object for a mediawiki message
+ *
+ * @param IContextSource $context
+ * @param string $key Key of message to get the title from
+ * @return Title
+ */
+ public static function makeTitle( $context, $key ) {
+ $lang = $context->getLanguage();
+ if ( in_array( $key, (array)$context->getConfig()->get(
'ForceUIMsgAsContentMsg' ) ) ) {
+ $key .= '/' . $lang->getCode();
+ }
+ return Title::makeTitle( NS_MEDIAWIKI, $lang->ucfirst( strtr(
$key, ' ', '_' ) ) );
+ }
+
+ /**
* Adds parameters to the parameter list of this message.
*
* @since 1.17
diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php
index 76ad252..e2a660d 100644
--- a/includes/ProtectionForm.php
+++ b/includes/ProtectionForm.php
@@ -542,7 +542,7 @@
$out .= Xml::closeElement( 'fieldset' );
if ( $user->isAllowed( 'editinterface' ) ) {
- $title = Title::makeTitle( NS_MEDIAWIKI,
'Protect-dropdown' );
+ $title = Message::makeTitle( $this->mContext,
'protect-dropdown' );
$link = Linker::link(
$title,
wfMessage( 'protect-edit-reasonlist'
)->escaped(),
diff --git a/includes/page/Article.php b/includes/page/Article.php
index 0318f65..ad92e20 100644
--- a/includes/page/Article.php
+++ b/includes/page/Article.php
@@ -1771,7 +1771,7 @@
Xml::closeElement( 'form' );
if ( $user->isAllowed( 'editinterface' ) ) {
- $dropdownTitle = Title::makeTitle(
NS_MEDIAWIKI, 'Deletereason-dropdown' );
+ $dropdownTitle = Message::makeTitle( $ctx,
'deletereason-dropdown' );
$link = Linker::link(
$dropdownTitle,
wfMessage( 'delete-edit-reasonlist'
)->escaped(),
diff --git a/includes/specials/SpecialBlock.php
b/includes/specials/SpecialBlock.php
index 14d97eb..ba63756 100644
--- a/includes/specials/SpecialBlock.php
+++ b/includes/specials/SpecialBlock.php
@@ -385,7 +385,7 @@
# Link to edit the block dropdown reasons, if applicable
if ( $user->isAllowed( 'editinterface' ) ) {
$links[] = Linker::link(
- Title::makeTitle( NS_MEDIAWIKI,
'Ipbreason-dropdown' ),
+ Message::makeTitle( $this->getContext(),
'ipbreason-dropdown' ),
$this->msg( 'ipb-edit-dropdown' )->escaped(),
array(),
array( 'action' => 'edit' )
diff --git a/includes/specials/SpecialRevisiondelete.php
b/includes/specials/SpecialRevisiondelete.php
index 7eea71d..8d564e7 100644
--- a/includes/specials/SpecialRevisiondelete.php
+++ b/includes/specials/SpecialRevisiondelete.php
@@ -456,7 +456,7 @@
Xml::closeElement( 'form' ) . "\n";
// Show link to edit the dropdown reasons
if ( $this->getUser()->isAllowed( 'editinterface' ) ) {
- $title = Title::makeTitle( NS_MEDIAWIKI,
'Revdelete-reason-dropdown' );
+ $title = Message::makeTitle(
$this->getContext(), 'revdelete-reason-dropdown' );
$link = Linker::link(
$title,
$this->msg( 'revdelete-edit-reasonlist'
)->escaped(),
diff --git a/includes/specials/SpecialTags.php
b/includes/specials/SpecialTags.php
index b762728..b97eb30 100644
--- a/includes/specials/SpecialTags.php
+++ b/includes/specials/SpecialTags.php
@@ -75,7 +75,7 @@
if ( $user->isAllowed( 'editinterface' ) ) {
$disp .= ' ';
$editLink = Linker::link(
- Title::makeTitle( NS_MEDIAWIKI, "Tag-$tag" ),
+ Message::makeTitle( $this->getContext(),
"tag-$tag" ),
$this->msg( 'tags-edit' )->escaped()
);
$disp .= $this->msg( 'parentheses' )->rawParams(
$editLink )->escaped();
@@ -87,7 +87,7 @@
if ( $user->isAllowed( 'editinterface' ) ) {
$desc .= ' ';
$editDescLink = Linker::link(
- Title::makeTitle( NS_MEDIAWIKI,
"Tag-$tag-description" ),
+ Message::makeTitle( $this->getContext(),
"tag-$tag-description" ),
$this->msg( 'tags-edit' )->escaped()
);
$desc .= $this->msg( 'parentheses' )->rawParams(
$editDescLink )->escaped();
diff --git a/includes/specials/SpecialUpload.php
b/includes/specials/SpecialUpload.php
index ee89b0a..6149b57 100644
--- a/includes/specials/SpecialUpload.php
+++ b/includes/specials/SpecialUpload.php
@@ -801,7 +801,7 @@
# Add a link to edit MediaWik:Licenses
if ( $this->getUser()->isAllowed( 'editinterface' ) ) {
$licensesLink = Linker::link(
- Title::makeTitle( NS_MEDIAWIKI, 'Licenses' ),
+ Message::makeTitle( $this->getContext(),
'licenses' ),
$this->msg( 'licenses-edit' )->escaped(),
array(),
array( 'action' => 'edit' )
--
To view, visit https://gerrit.wikimedia.org/r/179630
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib800b9adcc9ae88ef53228b66838bf61d2065f0f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits