From 604a4d4a41458907f7d52a45c56c97e62df329c2 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Mon, 6 Aug 2012 03:36:01 +0200 Subject: [PATCH] Solve some i18n issues in Special:EmailUser. * Page title was also "E-mail this user" if no target was provided. Created 'emailuser-title-notarget' for this. * Created 'emailuser-title-target' with GENDER support to provide a genderised page title, reducing re-use with 'emailuser' that's also used in the sidebar. * Update documentation for 'defemailsubject' to note that GENDER is supported. Change-Id: Id39c537e3717e24c9834526898f5a95585080204 --- includes/specials/SpecialEmailuser.php | 19 ++++++++++++++++--- languages/messages/MessagesEn.php | 2 ++ languages/messages/MessagesQqq.php | 8 ++++++-- maintenance/language/messages.inc | 2 ++ 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/includes/specials/SpecialEmailuser.php b/includes/specials/SpecialEmailuser.php index 3d6033e90f..4d875e6ef9 100644 --- a/includes/specials/SpecialEmailuser.php +++ b/includes/specials/SpecialEmailuser.php @@ -33,6 +33,15 @@ class SpecialEmailUser extends UnlistedSpecialPage { parent::__construct( 'Emailuser' ); } + public function getDescription() { + $target = self::getTarget( $this->mTarget ); + if( !$target instanceof User ) { + return $this->msg( 'emailuser-title-notarget' )->text(); + } + + return $this->msg( 'emailuser-title-target', $target->getName() )->text(); + } + protected function getFormFields() { return array( 'From' => array( @@ -84,13 +93,18 @@ class SpecialEmailUser extends UnlistedSpecialPage { } public function execute( $par ) { - $this->setHeaders(); - $this->outputHeader(); $out = $this->getOutput(); $out->addModuleStyles( 'mediawiki.special' ); + $this->mTarget = is_null( $par ) ? $this->getRequest()->getVal( 'wpTarget', $this->getRequest()->getVal( 'target', '' ) ) : $par; + + // This needs to be below assignment of $this->mTarget because + // getDescription() needs it to determine the correct page title. + $this->setHeaders(); + $this->outputHeader(); + // error out if sending user cannot do this $error = self::getPermissionsError( $this->getUser(), $this->getRequest()->getVal( 'wpEditToken' ) ); switch ( $error ) { @@ -136,7 +150,6 @@ class SpecialEmailUser extends UnlistedSpecialPage { return false; } - $out->setPageTitle( $this->msg( 'emailpage' ) ); $result = $form->show(); if( $result === true || ( $result instanceof Status && $result->isGood() ) ) { diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 41312c5612..059dc40a03 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -2794,6 +2794,8 @@ There may be [[{{MediaWiki:Listgrouprights-helppage}}|additional information]] a 'mailnologin' => 'No send address', 'mailnologintext' => 'You must be [[Special:UserLogin|logged in]] and have a valid e-mail address in your [[Special:Preferences|preferences]] to send e-mail to other users.', 'emailuser' => 'E-mail this user', +'emailuser-title-target' => 'E-mail this {{GENDER:$1|user}}', +'emailuser-title-notarget' => 'E-mail user', 'emailuser-summary' => '', # do not translate or duplicate this message to other languages 'emailpage' => 'E-mail user', 'emailpagetext' => 'You can use the form below to send an e-mail message to this user. diff --git a/languages/messages/MessagesQqq.php b/languages/messages/MessagesQqq.php index 3a03e539d1..1df7df68b1 100644 --- a/languages/messages/MessagesQqq.php +++ b/languages/messages/MessagesQqq.php @@ -2593,12 +2593,16 @@ See also {{msg-mw|listgrouprights-addgroup-all}}.', * $2 is the number of group names in $1.', # E-mail user -'emailuser' => 'Link in the sidebar and title of [[Special:EmailUser|special page]]', +'emailuser' => 'Link in the sidebar to send an e-mail to a user.', +'emailuser-title-target' => 'Title of [[Special:EmailUser|special page]] when a user was given to e-mail. Parameters: +* $1 is a plain text username, used for GENDER.', +'emailuser-title-notarget' => 'Title of [[Special:EmailUser|special page]] when no user given to e-mail yet', 'emailpage' => "Title of special page [[Special:EmailUser]], when it is the destination of the sidebar link {{msg-mw|Emailuser}} on a user's page.", 'emailpagetext' => 'This is the text that is displayed above the e-mail form on [[Special:EmailUser]]. Special:EmailUser appears when you click on the link "E-mail this user" in the sidebar, but only if there is an e-mail address in the recipient\'s user preferences. If there isn\'t then the message [[Mediawiki:Noemailtext]] will appear instead of Special:EmailUser.', -'defemailsubject' => 'The default subject of EmailUser emails. The first parameter is the username of the user sending the email.', +'defemailsubject' => 'The default subject of EmailUser emails. Parameters: +* $1 is the username of the user sending the email and can be used for GENDER.', 'usermaildisabled' => 'Caption for an error message ({{msg-mw|Usermaildisabledtext}}) shown when the user-to-user e-mail feature is disabled on the wiki (see [[mw:Manual:$wgEnableEmail]], [[mw:Manual:$wgEnableUserEmail]]).', 'noemailtitle' => 'The title of the message that appears instead of Special:EmailUser after clicking the "E-mail this user" link in the sidebar, if no e-mail can be sent to the user.', 'noemailtext' => 'The text of the message that appears in [[Special:EmailUser]] after clicking the "E-mail this user" link in the sidebar, if no e-mail can be sent to the user because he has not specified or not confirmed an e-mail address.', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index bed7e5adcd..059dcd682f 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -1861,6 +1861,8 @@ $wgMessageStructure = array( 'mailnologin', 'mailnologintext', 'emailuser', + 'emailuser-title-target', + 'emailuser-title-notarget', 'emailuser-summary', 'emailpage', 'emailpagetext', -- 2.20.1