From: Amir E. Aharoni Date: Mon, 16 Apr 2012 19:39:50 +0000 (+0300) Subject: Refactoring previewnote. X-Git-Tag: 1.31.0-rc.0~23844^2 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=aacf4d29f9810edcbe9ebf16e1ad865d244a357e;p=lhc%2Fweb%2Fwiklou.git Refactoring previewnote. 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 --- diff --git a/includes/EditPage.php b/includes/EditPage.php index 69187e488a..d477716a1c 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -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 ) ? - 'editing' : 'creating'; + $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; - if ( $displayTitle === false ) { - $displayTitle = $contextTitle->getPrefixedText(); + $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 ); diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 9a55c3d291..2a85c03f8e 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -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. diff --git a/languages/messages/MessagesQqq.php b/languages/messages/MessagesQqq.php index 58501278c1..5ce5c17cb6 100644 --- a/languages/messages/MessagesQqq.php +++ b/languages/messages/MessagesQqq.php @@ -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''\".", diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 4984495753..dc72577734 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -623,6 +623,7 @@ $wgMessageStructure = array( 'updated', 'note', 'previewnote', + 'continue-editing', 'previewconflict', 'session_fail_preview', 'session_fail_preview_html',