Fixes for r60599:
[lhc/web/wiklou.git] / languages / classes / LanguageYue.php
index fc7f233..f00ac31 100644 (file)
@@ -3,19 +3,25 @@
  * @ingroup Language
  */
 class LanguageYue extends Language {
-       function stripForSearch( $string ) {
+       function stripForSearch( $string, $doStrip = true ) {
                wfProfileIn( __METHOD__ );
 
-               // eventually this should be a word segmentation
-               // for now just treat each character as a word
-               // @fixme only do this for Han characters...
-               $t = preg_replace(
-                               "/([\\xc0-\\xff][\\x80-\\xbf]*)/",
-                               " $1", $string);
+               // Double-width roman characters
+               $s = self::convertDoubleWidth( $string );
+
+               if ( $doStrip == true ) {
+                       // eventually this should be a word segmentation;
+                       // for now just treat each character as a word.
+                       // @todo Fixme: only do this for Han characters...
+                       $reg = "/([\\xc0-\\xff][\\x80-\\xbf]*)/";
+                       $s = self::wordSegmentation( $s, $reg );
+               }
+
+               $s = trim( $s );
 
                // Do general case folding and UTF-8 armoring
-               $t = parent::stripForSearch( $t );
+               $s = parent::stripForSearch( $s, $doStrip );
                wfProfileOut( __METHOD__ );
-               return $t;
+               return $s;
        }
 }