Refactoring previewnote.
authorAmir E. Aharoni <amir.aharoni@mail.huji.ac.il>
Mon, 16 Apr 2012 19:39:50 +0000 (22:39 +0300)
committerAmir E. Aharoni <amir.aharoni@mail.huji.ac.il>
Mon, 16 Apr 2012 19:48:55 +0000 (22:48 +0300)
This is a followup to https://gerrit.wikimedia.org/r/#change,3978 .

Splitting the message previewnote to two messages: one is the note
itself, as it was before change 3978, and the other is the link text.

This change relieves the translators from the need to type wiki code
in the translated message and to wonder whether they should translate
"editform" or not.

Change-Id: I50aaf6dd48aaeee86cacf5c8fc06594869b38fd9

includes/EditPage.php
languages/messages/MessagesEn.php
languages/messages/MessagesQqq.php
maintenance/language/messages.inc

index 69187e4..d477716 100644 (file)
@@ -144,6 +144,11 @@ class EditPage {
         */
        const AS_IMAGE_REDIRECT_LOGGED     = 234;
 
+       /**
+        * HTML id and name for the beginning of the edit form.
+        */
+       const EDITFORM_ID                  = 'editform';
+
        /**
         * @var Article
         */
@@ -1609,13 +1614,13 @@ class EditPage {
                } elseif ( $contextTitle->exists() && $this->section != '' ) {
                        $msg = $this->section == 'new' ? 'editingcomment' : 'editingsection';
                } else {
-                       $msg = $contextTitle->exists() || ( $contextTitle->getNamespace() == NS_MEDIAWIKI && $contextTitle->getDefaultMessageText() !== false ) ?\r
-                               'editing' : 'creating';\r
+                       $msg = $contextTitle->exists() || ( $contextTitle->getNamespace() == NS_MEDIAWIKI && $contextTitle->getDefaultMessageText() !== false ) ?
+                               'editing' : 'creating';
                }
                # Use the title defined by DISPLAYTITLE magic word when present
-               $displayTitle = isset( $this->mParserOutput ) ? $this->mParserOutput->getDisplayTitle() : false;\r
-               if ( $displayTitle === false ) {\r
-                       $displayTitle = $contextTitle->getPrefixedText();\r
+               $displayTitle = isset( $this->mParserOutput ) ? $this->mParserOutput->getDisplayTitle() : false;
+               if ( $displayTitle === false ) {
+                       $displayTitle = $contextTitle->getPrefixedText();
                }
                $wgOut->setPageTitle( wfMessage( $msg, $displayTitle ) );
        }
@@ -1769,7 +1774,7 @@ class EditPage {
                        }
                }
 
-               $wgOut->addHTML( Html::openElement( 'form', array( 'id' => 'editform', 'name' => 'editform',
+               $wgOut->addHTML( Html::openElement( 'form', array( 'id' => EDITFORM_ID, 'name' => EDITFORM_ID,
                        'method' => 'post', 'action' => $this->getActionURL( $this->getContextTitle() ),
                        'enctype' => 'multipart/form-data' ) ) );
 
@@ -2550,7 +2555,7 @@ HTML
         * @return string
         */
        function getPreviewText() {
-               global $wgOut, $wgUser, $wgParser, $wgRawHtml;
+               global $wgOut, $wgUser, $wgParser, $wgRawHtml, $wgLang;
 
                wfProfileIn( __METHOD__ );
 
@@ -2578,7 +2583,8 @@ HTML
                } elseif ( $this->incompleteForm ) {
                        $note = wfMsg( 'edit_form_incomplete' );
                } else {
-                       $note = wfMsg( 'previewnote' );
+                       $note = wfMsg( 'previewnote' ) .
+                               ' [[#' . EDITFORM_ID . '|' . $wgLang->getArrow() . ' ' . wfMsg( 'continue-editing' ) . ']]';
                }
 
                $parserOptions = ParserOptions::newFromUser( $wgUser );
index 9a55c3d..2a85c03 100644 (file)
@@ -1372,7 +1372,8 @@ Custom .css and .js pages use a lowercase title, e.g. {{ns:user}}:Foo/vector.css
 'updated'                          => '(Updated)',
 'note'                             => "'''Note:'''",
 'previewnote'                      => "'''Remember that this is only a preview.'''
-Your changes have not yet been saved! [[#editform|→ Continue editing]]",
+Your changes have not yet been saved!",
+'continue-editing'                 => "Continue editing",
 'previewconflict'                  => 'This preview reflects the text in the upper text editing area as it will appear if you choose to save.',
 'session_fail_preview'             => "'''Sorry! We could not process your edit due to a loss of session data.'''
 Please try again.
index 5850127..5ce5c17 100644 (file)
@@ -972,6 +972,7 @@ See also {{msg-mw|Noarticletext-nopermission}}.',
 'sitejspreview' => 'Text displayed on preview of .js pages in MediaWiki namespace',
 'updated' => '{{Identical|Updated}}',
 'previewnote' => 'Note displayed when clicking on Show preview',
+'continue-editing' => 'A link to the beginning of the editing textarea on the same page. Displayed after {{msg-mw|previewnote}}.',
 'editing' => "Shown as page title when editing a page. \$1 is the name of the page that is being edited. Example: \"''Editing Main Page''\".",
 'creating' => "Shown as page title when creating a page. Parameters:
 * \$1 is the name of the page that is being created. Example: \"''Creating Main Page''\".",
index 4984495..dc72577 100644 (file)
@@ -623,6 +623,7 @@ $wgMessageStructure = array(
                'updated',
                'note',
                'previewnote',
+               'continue-editing',
                'previewconflict',
                'session_fail_preview',
                'session_fail_preview_html',