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