Solve some i18n issues in Special:EmailUser.
authorSiebrand Mazeland <s.mazeland@xs4all.nl>
Mon, 6 Aug 2012 01:36:01 +0000 (03:36 +0200)
committerSiebrand Mazeland <s.mazeland@xs4all.nl>
Sun, 19 Aug 2012 19:57:22 +0000 (21:57 +0200)
* 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
languages/messages/MessagesEn.php
languages/messages/MessagesQqq.php
maintenance/language/messages.inc

index 3d6033e..4d875e6 100644 (file)
@@ -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() ) ) {
index 41312c5..059dc40 100644 (file)
@@ -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.
index 3a03e53..1df7df6 100644 (file)
@@ -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.',
index bed7e5a..059dcd6 100644 (file)
@@ -1861,6 +1861,8 @@ $wgMessageStructure = array(
                'mailnologin',
                'mailnologintext',
                'emailuser',
+               'emailuser-title-target',
+               'emailuser-title-notarget',
                'emailuser-summary',
                'emailpage',
                'emailpagetext',