From: Zheng Zhu Date: Mon, 29 Nov 2004 01:46:23 +0000 (+0000) Subject: better support for multiple language variants when displaying the search result. X-Git-Tag: 1.5.0alpha1~1203 X-Git-Url: http://git.cyclocoop.org/%22.%28%24lien.?a=commitdiff_plain;h=a24386a900232d6248f398e786597937ab01585c;p=lhc%2Fweb%2Fwiklou.git better support for multiple language variants when displaying the search result. --- diff --git a/includes/SpecialSearch.php b/includes/SpecialSearch.php index d390fb3579..95ca38055a 100644 --- a/includes/SpecialSearch.php +++ b/includes/SpecialSearch.php @@ -162,7 +162,9 @@ class SpecialSearch { $wgOut->addHTML( "
{$prevnext}\n" ); } - $terms = implode( '|', $search->termMatches() ); + global $wgContLang; + $tm = $wgContLang->convertForSearchResult( $search->termMatches() ); + $terms = implode( '|', $tm ); if( $titleMatches->numRows() ) { $wgOut->addWikiText( '==' . wfMsg( 'titlematches' ) . "==\n" ); @@ -299,6 +301,10 @@ class SpecialSearch { $out .= $this->showHit( $row, $terms ); } $out .= "\n"; + + // convert the whole thing to desired language variant + global $wgContLang; + $out = $wgContLang->convert( $out ); wfProfileOut( $fname ); return $out; } @@ -329,8 +335,10 @@ class SpecialSearch { $size = wfMsg( 'nbytes', strlen( $row->cur_text ) ); $lines = explode( "\n", $row->cur_text ); + $max = IntVal( $contextchars ) + 1; $pat1 = "/(.*)($terms)(.{0,$max})/i"; + $lineno = 0; $extract = '';