wiki.techinc.nl/languages/classes/LanguageZh_hans.php

48 lines
823 B
PHP
Raw Normal View History

<?php
/**
2010-10-10 12:53:37 +00:00
* Simplified Chinese
*
* @ingroup Language
*/
class LanguageZh_hans extends Language {
2011-05-29 15:21:03 +00:00
/**
* @return bool
*/
function hasWordBreaks() {
return false;
}
/**
* Eventually this should be a word segmentation;
* for now just treat each character as a word.
* @todo FIXME: Only do this for Han characters...
2011-05-29 15:21:03 +00:00
*
* @param $string string
*
* @return string
*/
function segmentByWord( $string ) {
$reg = "/([\\xc0-\\xff][\\x80-\\xbf]*)/";
$s = self::insertSpace( $string, $reg );
return $s;
}
2011-05-29 15:03:33 +00:00
/**
* @param $s
* @return string
*/
function normalizeForSearch( $s ) {
wfProfileIn( __METHOD__ );
// Double-width roman characters
$s = parent::normalizeForSearch( $s );
$s = trim( $s );
$s = $this->segmentByWord( $s );
wfProfileOut( __METHOD__ );
return $s;
}
}