Add search results found as parameter to showCreateLink
authorAlex Ivanov <alexivanov97@gmail.com>
Wed, 4 Dec 2013 23:01:27 +0000 (01:01 +0200)
committerAlex Ivanov <alexivanov97@gmail.com>
Sat, 7 Dec 2013 23:46:24 +0000 (01:46 +0200)
Add search results found as $2 parameter to messages:

* searchmenu-new
* searchmenu-exists
* searchmenu-nocreate

to allow better message displaying.

Bug: 20976
Change-Id: I4cd9bcfa6b7a9f9155b639f9dc9ed1ff8be0d384

includes/specials/SpecialSearch.php
languages/messages/MessagesEn.php
languages/messages/MessagesQqq.php

index bdcecf9..3d23884 100644 (file)
@@ -376,7 +376,7 @@ class SpecialSearch extends SpecialPage {
                // prev/next links
                if ( $num || $this->offset ) {
                        // Show the create link ahead
-                       $this->showCreateLink( $t );
+                       $this->showCreateLink( $t, $num );
                        $prevnext = $this->getLanguage()->viewPrevNext( $this->getTitle(), $this->offset, $this->limit,
                                $this->powerSearchOptions() + array( 'search' => $term ),
                                max( $titleMatchesNum, $textMatchesNum ) < $this->limit
@@ -422,7 +422,7 @@ class SpecialSearch extends SpecialPage {
                        } else {
                                $out->wrapWikiMsg( "<p class=\"mw-search-nonefound\">\n$1</p>",
                                        array( 'search-nonefound', wfEscapeWikiText( $term ) ) );
-                               $this->showCreateLink( $t );
+                               $this->showCreateLink( $t, $num );
                        }
                }
                $out->addHtml( "</div>" );
@@ -436,8 +436,9 @@ class SpecialSearch extends SpecialPage {
 
        /**
         * @param $t Title
+        * @param int $num The number of search results found
         */
-       protected function showCreateLink( $t ) {
+       protected function showCreateLink( $t, $num ) {
                // show direct page/create link if applicable
 
                // Check DBkey !== '' in case of fragment link only.
@@ -455,7 +456,7 @@ class SpecialSearch extends SpecialPage {
                } else {
                        $messageName = 'searchmenu-new-nocreate';
                }
-               $params = array( $messageName, wfEscapeWikiText( $t->getPrefixedText() ) );
+               $params = array( $messageName, wfEscapeWikiText( $t->getPrefixedText() ), Message::numParam( $num ) );
                wfRunHooks( 'SpecialSearchCreateLink', array( $t, &$params ) );
 
                // Extensions using the hook might still return an empty $messageName
index 954940e..50c0b2f 100644 (file)
@@ -1815,8 +1815,8 @@ Details can be found in the [{{fullurl:{{#Special:Log}}/delete|page={{FULLPAGENA
 'nextn-title'                      => 'Next $1 {{PLURAL:$1|result|results}}',
 'shown-title'                      => 'Show $1 {{PLURAL:$1|result|results}} per page',
 'viewprevnext'                     => 'View ($1 {{int:pipe-separator}} $2) ($3)',
-'searchmenu-exists'                => "'''There is a page named \"[[:\$1]]\" on this wiki.'''",
-'searchmenu-new'                   => "'''Create the page \"[[:\$1]]\" on this wiki!'''",
+'searchmenu-exists'                => "'''There is a page named \"[[:\$1]]\" on this wiki.''' {{PLURAL:$2|0=|See also the other search results found.}}",
+'searchmenu-new'                   => "'''Create the page \"[[:\$1]]\" on this wiki!''' {{PLURAL:$2|0=|See also the page found with your search.|See also the search results found.}}",
 'searchmenu-new-nocreate'          => '', # do not translate or duplicate this message to other languages
 'searchprofile-articles'           => 'Content pages',
 'searchprofile-project'            => 'Help and Project pages',
index 11eff9e..6ebaf69 100644 (file)
@@ -2812,11 +2812,13 @@ Refers to {{msg-mw|Pipe-separator}}.',
 'searchmenu-exists' => 'An option shown in a menu beside search form offering a link to the existing page having the specified title (when using the default MediaWiki search engine).
 
 Parameters:
-* $1 - page title',
+* $1 - page title
+* $2 - the number of search results found',
 'searchmenu-new' => 'An option shown in a menu beside search form offering a red link to the not yet existing page having the specified title (when using the default MediaWiki search engine).
 
 Parameters:
-* $1 - page title',
+* $1 - page title
+* $2 - the number of search results found',
 'searchprofile-articles' => "A quick link in the advanced search box on [[Special:Search]]. Clicking on this link starts a search in the content pages of the wiki.
 
 A 'content page' is a page that forms part of the purpose of the wiki. It includes the main page and pages in the main namespace and any other namespaces that are included when the wiki is customised. For example on Wikimedia Commons 'content pages' include pages in the file and category namespaces. On Wikinews 'content pages' include pages in the Portal namespace. For technical definition of 'content namespaces' see [[mw:Manual:Using_custom_namespaces#Content_namespaces|MediaWiki]].