d93404ac0b1508fb169a025a679b0f13d7faddc2
[lhc/web/wiklou.git] / languages / classes / LanguageZh_hans.php
1 <?php
2
3 /**
4 * @ingroup Language
5 */
6 class LanguageZh_hans extends Language {
7 function hasWordBreaks() {
8 return false;
9 }
10
11 /**
12 * Eventually this should be a word segmentation;
13 * for now just treat each character as a word.
14 * @todo Fixme: only do this for Han characters...
15 */
16 function segmentByWord( $string ) {
17 $reg = "/([\\xc0-\\xff][\\x80-\\xbf]*)/";
18 $s = self::insertSpace( $string, $reg );
19 return $s;
20 }
21
22 function normalizeForSearch( $s ) {
23 wfProfileIn( __METHOD__ );
24
25 // Double-width roman characters
26 $s = parent::normalizeForSearch( $s );
27 $s = trim( $s );
28 $s = self::segmentByWord( $s );
29
30 wfProfileOut( __METHOD__ );
31 return $s;
32 }
33 }