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