Merge "Genderize Special:Preferences"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sun, 9 Dec 2012 23:28:47 +0000 (23:28 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sun, 9 Dec 2012 23:28:47 +0000 (23:28 +0000)
1  2 
includes/Preferences.php
languages/messages/MessagesQqq.php

diff --combined includes/Preferences.php
@@@ -158,18 -158,21 +158,21 @@@ class Preferences 
                        $wgEnableEmail, $wgEmailConfirmToEdit, $wgEnableUserEmail, $wgEmailAuthentication,
                        $wgEnotifWatchlist, $wgEnotifUserTalk, $wgEnotifRevealEditorAddress;
  
+               // retrieving user name for GENDER and misc.
+               $userName = $user->getName();
                ## User info #####################################
                // Information panel
                $defaultPreferences['username'] = array(
                        'type' => 'info',
-                       'label-message' => 'username',
-                       'default' => $user->getName(),
+                       'label-message' => array( 'username', $userName ),
+                       'default' => $userName,
                        'section' => 'personal/info',
                );
  
                $defaultPreferences['userid'] = array(
                        'type' => 'info',
-                       'label-message' => 'uid',
+                       'label-message' => array( 'uid', $userName ),
                        'default' => $user->getId(),
                        'section' => 'personal/info',
                );
                        $groupName  = User::getGroupName( $ueg );
                        $userGroups[] = User::makeGroupLinkHTML( $ueg, $groupName );
  
-                       $memberName = User::getGroupMember( $ueg, $user->getName() );
+                       $memberName = User::getGroupMember( $ueg, $userName );
                        $userMembers[] = User::makeGroupLinkHTML( $ueg, $memberName );
                }
                asort( $userGroups );
                $defaultPreferences['usergroups'] = array(
                        'type' => 'info',
                        'label' => $context->msg( 'prefs-memberingroups' )->numParams(
-                               count( $userGroups ) )->parse(),
+                               count( $userGroups ) )->params( $userName )->parse(),
                        'default' => $context->msg( 'prefs-memberingroups-type',
                                $lang->commaList( $userGroups ),
                                $lang->commaList( $userMembers )
                if ( $wgAuth->allowPasswordChange() ) {
                        $link = Linker::link( SpecialPage::getTitleFor( 'ChangePassword' ),
                                $context->msg( 'prefs-resetpass' )->escaped(), array(),
 -                              array( 'returnto' => SpecialPage::getTitleFor( 'Preferences' ) ) );
 +                              array( 'returnto' => SpecialPage::getTitleFor( 'Preferences' )->getPrefixedText() ) );
  
                        $defaultPreferences['password'] = array(
                                'type' => 'info',
                                SpecialPage::getTitleFor( 'ChangeEmail' ),
                                $context->msg( $user->getEmail() ? 'prefs-changeemail' : 'prefs-setemail' )->escaped(),
                                array(),
 -                              array( 'returnto' => SpecialPage::getTitleFor( 'Preferences' ) ) );
 +                              array( 'returnto' => SpecialPage::getTitleFor( 'Preferences' )->getPrefixedText() ) );
  
                        $emailAddress = $user->getEmail() ? htmlspecialchars( $user->getEmail() ) : '';
                        if ( $wgAuth->allowPropChange( 'emailaddress' ) ) {
                # be nice to somehow merge this back in there to avoid redundancy.
                if ( $wgAllowUserCss || $wgAllowUserJs ) {
                        $linkTools = array();
+                       $userName = $user->getName();
  
                        if ( $wgAllowUserCss ) {
-                               $cssPage = Title::makeTitleSafe( NS_USER, $user->getName() . '/common.css' );
+                               $cssPage = Title::makeTitleSafe( NS_USER, $userName . '/common.css' );
                                $linkTools[] = Linker::link( $cssPage, $context->msg( 'prefs-custom-css' )->escaped() );
                        }
  
                        if ( $wgAllowUserJs ) {
-                               $jsPage = Title::makeTitleSafe( NS_USER, $user->getName() . '/common.js' );
+                               $jsPage = Title::makeTitleSafe( NS_USER, $userName . '/common.js' );
                                $linkTools[] = Linker::link( $jsPage, $context->msg( 'prefs-custom-js' )->escaped() );
                        }
  
                        'section' => 'searchoptions/advancedsearchoptions',
                );
  
-               $nsOptions = array();
-               foreach ( $wgContLang->getNamespaces() as $ns => $name ) {
-                       if ( $ns < 0 ) {
-                               continue;
-                       }
-                       $displayNs = str_replace( '_', ' ', $name );
-                       if ( !$displayNs ) {
-                               $displayNs = $context->msg( 'blanknamespace' )->text();
-                       }
-                       $displayNs = htmlspecialchars( $displayNs );
-                       $nsOptions[$displayNs] = $ns;
+               $nsOptions = $wgContLang->getFormattedNamespaces();
+               $nsOptions[0] = $context->msg( 'blanknamespace' )->text();
+               foreach ( $nsOptions as $ns => $name ) {
+                       if ( $ns < 0 )
+                               unset( $nsOptions[$ns] );
                }
  
                $defaultPreferences['searchnamespaces'] = array(
                        'type' => 'multiselect',
                        'label-message' => 'defaultns',
-                       'options' => $nsOptions,
+                       'options' => array_flip( $nsOptions ),
                        'section' => 'searchoptions/advancedsearchoptions',
                        'prefix' => 'searchNs',
                );
@@@ -1576,9 -1576,13 +1576,13 @@@ Shown as legend of the second fieldset 
  'youremail' => 'Label of the e-mail text box of the "E-mail options" section of "Special:Preferences".
  
  {{Identical|E-mail}}',
- 'username' => '{{Identical|Username}}',
- 'uid' => '{{Identical|User ID}}',
- 'prefs-memberingroups' => 'This message is shown on [[Special:Preferences]], first tab. See also {{msg-mw|prefs-memberingroups-type}}.',
+ 'username' => 'Username field in [[Special:Preferences]]. $1 is the current user name for GENDER distinction (depends on sex setting).
+ {{Identical|Username}}',
+ 'uid' => 'User ID field in [[Special:Preferences]]. $1 is the current user name for GENDER distinction (depends on sex setting).
+ {{Identical|User ID}}',
+ 'prefs-memberingroups' => 'This message is shown on [[Special:Preferences]], first tab. See also {{msg-mw|prefs-memberingroups-type}}. $2 is the user name for GENDER.',
  'prefs-memberingroups-type' => '{{optional}}
  Parameters:
  * $1 is list of group names
@@@ -2777,7 -2781,6 +2781,7 @@@ Similar to {{msg-mw|rcnote}} which is u
  'watcherrortext' => 'When a user clicked the watch/unwatch tab and the action did not succeed, this message is displayed. See also {{msg|addedwatchtext}}. and {{msg|addedwatchtext}}. This message is used raw and should not contain wikitext.',
  
  'enotif_reset' => "This should be translated as \"Mark all pages '''as''' visited\".",
 +'enotif_impersonal_salutation' => 'Used for impersonal e-mail notifications, suitable for bulk mailing.',
  'enotif_subject_deleted' => 'Email notification subject for deleted pages, $1 is page title, $2 is page editor.',
  'enotif_subject_created' => 'Email notification subject for new pages, $1 is page title, $2 is page editor.',
  'enotif_subject_moved' => 'Email notification subject for pages that get moved, $1 is page title, $2 is page editor.',
  * $1 is the anonymous user name (i.e. an IP address).',
  'enotif_body' => 'Text of a notification e-mail sent when a watched page has been edited or deleted.[[File:Screenshot_MediaWiki_e-mail_notifier.PNG|150px|right]]
  
 -* <tt>$CHANGEDORCREATED</tt> can be one of {{msg-mw|changed}}, {{msg-mw|created}}, or {{msg-mw|deleted}}. Can also be {{msg-mw|blog-added}} or {{msg-mw|blog-edited}} from Wikia.',
 +*$WATCHINGUSERNAME is the username of the user receiving the notification.
 +*$PAGEINTRO is the first line of the message, saying what happened. It currently can be either of:
 +**{{msg-mw|enotif body intro deleted}}
 +**{{msg-mw|enotif body intro created}}
 +**{{msg-mw|enotif body intro moved}}
 +**{{msg-mw|enotif body intro restored}} 
 +**{{msg-mw|enotif body intro changed}} (for all the other cases).
 +*$NEWPAGE consists of either
 +**if the page is new (in older releases), {{msg-mw|enotif newpagetext}}
 +**if the page has a previous revision,
 +***{{msg-mw|enotif lastdiff}}
 +***a newline
 +***{{msg-mw|enotif lastvisited}}
 +*$PAGEEDITOR_EMAIL and $PAGEEDITOR_WIKI are links respectively to the e-mail user special page and user page for the user who performed the action.
 +
 +The subject of the e-mail is one of the following messages:
 +*{{msg-mw|enotif subject deleted}}
 +*{{msg-mw|enotif subject created}}
 +*{{msg-mw|enotif subject moved}}
 +*{{msg-mw|enotif subject restored}}
 +*{{msg-mw|enotif subject changed}}',
  
  # Delete
  'confirm' => 'Submit button text for protection confirmation