From a24386a900232d6248f398e786597937ab01585c Mon Sep 17 00:00:00 2001 From: Zheng Zhu Date: Mon, 29 Nov 2004 01:46:23 +0000 Subject: [PATCH] better support for multiple language variants when displaying the search result. --- includes/SpecialSearch.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 = ''; -- 2.20.1